Highlighting first time a value appears in Google Sheets - arrays

Is it possible to highlight cells where a value appears for the first time?
Eg:
A1 = 1
A2 = 2
A3 = 3
A4 = 4
A5 = 1
A6 = 2
So in the above A1-A4 would be highlighted but A5-A6 wouldn't as they are repeats of the same value

Try this: with apply to range set A1:A1000 take a look at the Example sheet.
Click Format and then Conditional formatting
Under the "Format cells if" drop-down menu, click Custom formula
=COUNTIF(A$1:A1,A1)=1
lock $ the row of the range of COUNTIF function to count only the immediate left cell and what above it till A1

Now if I wanted the lower numbers to be classed as the first entry, could I reverse this in some way? Ie using the above example it would be cells A3-A6 that would show as the first entries and A1-A2 wouldn't be highlighted
=INDEX(COUNTIFS(A:A,A1,ROW(A:A), ">="&ROW(A1)))=1
and the reverse of it would be:
=INDEX(COUNTIFS(A:A,A1,ROW(A:A), "<="&ROW(A1)))=1

Related

How to refer to a merged cell in a formula (or to a "bottom-up" range)

I've got this (long) table on Google Sheets:
The cells of column B may be vertically merged, but the number of rows for each multi-cell is random.
Since, for each multi-cell, the top cell is the one containing the value, I need to use a formula which refers, for instance, to the cell B1 in the cells A1 and A2, to the cell B3 in the cells A3, A4 and A5, and so forth.
I thought to build a kind of bottom-up coalesce. E.g. if I'm in cell A10, I want to go from $B10 towards the top until I find a non-null value (i.e. until $B7).
For doing this, I tried to insert the above formula in A10:
=INDEX($B10:$B$1,MATCH(FALSE,ISBLANK($B10:$B$1),FALSE))
but it doesn't accept a range starting from a lower position with respect to the endpoint. Or, better, such range will be automatically flipped to $B$1:$B10. It follows that the first non-empty value is the one of $B$1 and the returned value in A10 is 3 instead of 1.
Is there a way to express such inverted range? In case it isn't possible, how can I solve this problem?
in A10 or any other row you can use:
=INDEX(VLOOKUP(ROW(), IF(B:B<>"", {ROW(B:B), B:B}), 2))
if you want to fill the whole A column with B values use this in A1:
=INDEX(VLOOKUP(ROW(B:B), IF(B:B<>"", {ROW(B:B), B:B}), 2))
You can fill column C with values
=ArrayFormula(lookup(row(B1:B),row(B1:B)/if(B1:B<>"",1,0),B1:B))
or, for one specific row, you can retrieve the last value by
=ArrayFormula(lookup(row(),row(B$1:B)/if(B$1:B<>"",1,0),B$1:B))

Excel function: reference to array in cell

I have an array in cell A1 via
A1 = {=G6:J6} = {"aa"."b"."ccc".1}
Now I want to use the cell A1 for array formula in B1. Basically B1 should be
B1 = SUMPRODUKT((C6:C12)*(B6:B12=G6:J6))
But instead of the direct reference to G6:J6 I would like to use A1 instead. I just tried:
B1 = SUMPRODUKT((C6:C12)*(B6:B12=A1))
B1 = {=SUMPRODUKT((C6:C12)*(B6:B12=A1))}
But this would not work. Is there a way to make it work?
Greetings,
Peter
For questions that appeared:
Cells G6:J6 are input data for example article numbers. I want to setup the input data only once in my sheet so I have to update less data. entries in G6:J6 are strings or numbers. Let's say G6 = "aa", H6 = "b", I6 = "ccc" and J6 = 1.
Cell B1 is one point where I need to use the data. It would rather be in another sheet but for simpler examples let's assume it is cell B1. In B1 I could of course refer to G6:J6 but this makes formular less easy to read. Therefore I would like to put a reference A1 next to B1 so one can see easily what data B1 uses.
C6:C12 is some numbers and B6:B12 is some strings/numbers that maybe match G6:J6. So sumproduct should sumup the matches.
Your cell A1 contains an array formula or array range but it only contains a single value from that array or range (each Excel cell can only contain a single result value).
So you need to replace the A1 in your SUMPRODUCT with an array or range expression.
Cell A1 value shall be G6:J6
G6:J6 populated as required with {"aa","bb","ccc",1} then in B1 put following formula and check if this is what you need.
=SUMPRODUCT(C6:C12*ISNUMBER(SEARCH(B6:B12,INDIRECT(A1))))

Ignore blank parameters in Excel array formula

I'm using an array formula to return sums and counts on a large data set.
The array formula can have up to 3 arguments but the formula needs to accommodate when any or all of the arguments are <blank>, WITHOUT using VBA.
For example
A1 = "Australia"
B1 = "Finance"
C1 = "Female"
D1 contains the formula
D1 = {count(if((region=A1)*(sector=B1)*(gender=C1),population))}
Sometimes one of the criteria will be blank
A1 = "Australia"
B1 = <blank>
C1 = "Male"
In this case I'd like the formula to return the equivalent of:
D1 = {count(if((region=A1)*(gender=C1),population))}
In the extreme case A1, B1 and C1 could be all blank in which case the formula in D1 should return the equivalent of Count(population)
Is there a way to create an array formula that accounts for these possibilities? I originally tried to create a dynamic argument string
E1 = "(region=A1)*(sector=B1)*(gender=C1)"
and then use the string as the argument within the array formula
D1 = {count(if(E1,population))}
but I could find a way to get this to work.
I've tried a number of solutions, but there is always a key element missing. By using isblank I can determine if the cell is blank, but in order for this to be useful I'd need to turn this returned value into an array of boolean values of length count(population).
Any and all ideas are greatly appreciated.
Thanks.
Have you tried Nz() ? Encapsulate your current code with that and give it a try. I've had issues with blanks/nulls here and there myself.
Another option could be the IIF() statement. But that might not do what you want it to. Here are reference links:
Nz: http://www.techonthenet.com/access/functions/advanced/nz.php
IIF: http://www.techonthenet.com/access/functions/advanced/iif.php
You don't need VBA and you also don't even need an array formula. You can use SUMPRODUCT() with wildcards.
Say we have:
In A2 enter:
=IF(A1="","*",A1)
and copy across. This will display either an asterisk or the value above.
Then use:
=SUMPRODUCT(ISNUMBER(SEARCH(A2,G1:G10,1))*ISNUMBER(SEARCH(B2,H1:H10,1))*ISNUMBER(SEARCH(C2,I1:I10,1)))
This is a way to get SUMPRODUCT() to accept the asterisk as a wildcard:

Excel: Fill a range of cells with a value or formula depending on only one cell

We have a project on a certain math subject and I am done with the computations and it works just fine. So the task is, let's say you have a system of linear equations of certain number of unknowns, you input the number of unknowns, and fill in the values, and using matrix computations, find all the value of unknowns.
To make this short, I already finished the "find the value of unknowns" along with the computation, I checked it, and it seems fine. I can put 6 as the number of unknowns and it automatically computes the inverse of a 6x6 matrix and it will return the 6 unknown values using Index INDIVIDUALLY.
(Note: We aren't allowed to use VBA or Macros since we haven't discussed that yet.
The problem is, I don't know how to automatically fill a RANGE of cells with a VALUE or A FORMULA based on a SINGLE cell value.
For example, In cell A1, I will input 5 (which indicates the number of unknowns), then upon inputting this and hitting enter, let's say a range of cells A2 to A6 (which is 5 cells) will be automatically filled with incremented letters, like for A2 -> A ; A3 -> B ; ... A6 -> E, of which these letters indicate the 5 unknowns.
PROBLEM 2.
Another follow up question, let's say I input again 5, which again stands for the number of missing values/unknowns, in A1, besides the column of the variables A,B,C,D,E (5 unknowns), I want to automatically fill column B respectively with values from an array.
This is just the same with my first problem but this time, instead of incremented letters, it would be Incremented Index function.
For example: I input 5
*Column A will automatically be filled with the variables/letters
*Column B will automatically be filled with the values from an array that's computed using a formula but is not shown independently on cells.
I already have the formula
INDEX(Formula I created, Row number of the answer from the Formula I created , Column number of the answer from the formula I created)
The answers from the formula I made myself is also an array, an "n" rows and 1 column array. If I put the Index formula on a SINGLE cell, it returns specified row number value from the array that resulted in the computation from my formula
What I want is for example, for 5 unknowns
**A | B**
1|.......5..........................
2|.......A..............Some Value 1
3|.......B..............Some Value 2
4|.......C..............Some Value 3
5|.......D..............Some Value 4
6|.......E..............Some Value 5
Wherein the "Some Value" is the Arrayed Answer from my formula and the "1,2,3,4,5" specifies the row number from that arrayed answer.
This is upon inputting the matrix values, inputting the number of unknowns "n" in A1, and automatically filling a range of cells A2 to A"n" with letters A up to what letter "n" corresponds, and automatically filling a range of Cells B2 to B"n" with my formula but with incremented row number for every row in the Index(Formula, Row number , Column number) function.
Note: I hope there's a way to do this using excel functions only since we haven't discussed VBA or Macros yet so we can't use those, and even If we can, I have no knowledge for that. haha. :D
THANK YOU THANK YOU THANK YOU SO MUCH IN ADVANCED! Cheers. :D
Here's a formula for column A:A (write this in cell A2) and drag down:
=IF(ROW()-1<=$A$1,CHAR(ROW()+63),"")

Is it possible to display a message in an adjacent cell on Excel if there are ANY exact matches on the sheet?

I wouldn't say I was a complete beginner on Excel but I really can't work this out.
I'm putting together a database where if two cell values (alphanumeric) are the same, I need to be made aware.
So is there any formula that I can apply that will display the cell letter/number that has ANY exact match on the page. I.E:
C4 value is AEP314890 and I enter the same value in K9. Is there a formula that will display 'C4 MATCH' in cell L9?
Any help would be greatly appreciated.
Many thanks,
Matt
I would go with the countif function
=COUNTIF(B4:C7,F7) -> apply this in for example cell D4
Where B4:C7 is your range and F7 is the value that you want to compare. Now a second step would be a new IF to check if the value of D4 is higher than 0, then you can assume there exists the number already:
=IF(D4>0,"Found","not Found")
This would be the first step, now if you want to know where it is the same, you compare it with the Values simply.
Match() can help you,
http://www.techonthenet.com/excel/formulas/match_function.php
it returns the index of the matched cell in a range...
lets say
A | B
v1|v2
v3|v4
v5|v6
D1 = 'v5' E1 = Match(A1..B5, D1) = 5
you can then use then to find the Column Name and Row Name
C4 value is AEP314890 and I enter the same value in K9. Is there a
formula that will display 'C4 MATCH' in cell L9?
Just put this formula in your L9 Column .. assumed you search in C1:C100 ..
= If(Isna(Match(K9,$C$1:$C$100,0)),"","C" & TEXT(Match(K9,$C$1:$C$100,0),"###") & " Match !")

Resources