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))))
Related
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
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))
I have made a spreadsheet with type matchups for Pokemon. In A1 there is a dropdown of the attacking type and in B1 there is the defending type. I would like for C1 to spit out the type of effectiveness of the matchup. My original thought was to have C1 compare A1 to the cell in column B that matched its value, for example, if A1="Bug" C1 would find B3, and then C1 would compare B1 to the cell in row 2 that matched its value, for example, if B1="Dark" C1 would find D2. Then I would have C1 return the value from D3, the value you find from looking at column D and row 3.
How can I do this in sheets?
try:
=INDIRECT(ADDRESS(MATCH(A1, B2:B, 0)+1, MATCH(B1, 2:2, 0), 4))
You have a matrix of values with descriptors for each row and column. You want to name a descriptor for each of the horizontal and vertical axes, and return the value at the intersection of the row and column.
The following formula (entered at Cell C3) will return the value.
=index($C$3:$G$7,(match(A1,$B$3:$B$7,0)),(match(B1,$C$2:$G$2,0)))
Note: my test data spanned "$C$3:$G$7"; you will need to expand this for your data.
The answer uses both match and index:
match(A1,$B$3:$B$7,0): this looks up the Attacking Type (in cell A1) and then returns the row number for a match in column B
match(B1,$C$2:$G$2,0): this looks up the Defending Type (in cell B1) and then returns the Column number for a match in Row 2
INDEX: the syntax of index is "INDEX(reference, [row], [column])". The row and column have been supplied by the match statements. The "reference" is the matrix of data. The result is the value at the intersection of the row and column.
In this case, Attacking Type="BUG" and Defending Type = "Dark" will yield an outcome of "2x."
I would like to use one sumproduct formula that relies on an array of conditions of cellvalue. So basically I want to sum something when one of the entries of some cells where found before.
I can make the array of conditions work but not by cell values. In example.
Let A1 = "a", A2 = "b", B1 = 1, B2 = 2
Then
C1 = Sumproduct((A1:A100={"a"."b"})*(B1:B100)) = 3
works fine, but
C2 = Sumproduct((A1:A100=A1:A2)*(B1:B100)) = ERROR
Is there any way to put {"a"."b"} into a cell or an set of cells?
Greetings and Thanks for your help,
Peter
Disclaimer: I know I could simply write:
C2 = Sumproduct((A1:A100=A1)*(B1:B100)) + Sumproduct((A1:A100=A2)*(B1:B100))
But I would like to have a solution that is still nice to handle if 10+ conditions are on the list.
Use COUNTIF:
=SUMPRODUCT(COUNTIF(A1:A2,A1:A100)*B1:B100)
Use TRANSPOSE to make the cyclic calculation think of A1:A2 as being in a different order (... direction?) than A1:A100 and B1:B100.
=SUMPRODUCT((A1:A100=TRANSPOSE(A1:A2))*(B1:B100))
This formula is a true array formula and requires CSE.
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: