I am trying to write a sumifs formula which contains an array in the criteria but the array is in another cell which the sumifs formula will be referencing.
For example, I want to achieve this result, where I am summing column B if column A equals 5003 and 5009:
=SUM(SUMIFS(B:B,A:A,{"5003","5009"}))
However, instead of writing out "{"5003","5009"}" in the formula, I want this part to be referencing another cell which contains this array. For example, I want to do something like:
=SUM(SUMIFS(B:B,A:A,D1))
Where D1 equals:
D1="{"5003","5009"}"
How can I achieve this?
In D1 if your criteria's are comma separated then you can use FILTERXML() to build an array for SUMIFS() criteria. Try below
=SUM(SUMIFS(B:B,A:A,FILTERXML("<t><s>"&SUBSTITUTE($D$1,",","</s><s>")&"</s></t>","//s")))
If you data exactly looks like "{"5003","5009"}" in D1 cell then try below formula.
=SUM(SUMIFS(B:B,A:A,FILTERXML("<t><s>"&SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE($D$1,CHAR(34),""),"{",""),"}",""),",","</s><s>")&"</s></t>","//s")))
Related
I'm using countifs with an array to search for and count specific names from a column.
=ArrayFormula(SUM(COUNTIFS(A1:C10,{"Tom"; "Sam"; "Bill"})))
However, the array is likely to change, so rather than change the formula, I want to use a separate cell to "store" the array for the formula to reference.
=ArrayFormula(SUM(COUNTIFS(A1:C10,D1)))
Where D1 = {"Tom"; "Sam"; "Bill"}
Is there a way to reference an array from a different cell in a formula? Or is there a work around to accomplish the same thing? The "array reference cell" needs to be a single cell.
let D1 be:
(?i)Tom|Sam|Bill
and formula:
=SUMPRODUCT(REGEXMATCH(A1:C10; D1)*1)
Use this formula to count the number of times each name appears in the list "Array" To Count in column E.
=SUMPRODUCT(REGEXMATCH(A1:C;
REGEXREPLACE(TEXTJOIN("|";;UNIQUE($E$2:$E));".\z";"")))
The following works as expected and counts all the cells in the range A2:P2 that contains either PH, V or O.
=SUM(COUNTIFS(A2:P2;{"PH";"V";"O"}))
I have to reuse this several places and therefore want to place the criteria array in a cell and read it from there. Something like:
=SUM(COUNTIFS(A2:P2;"&A1&")) where cell A1 contains {"PH";"V";"O"}.
Is it possible to parse the text from A1 into the formula?
Assuming that you're using Excel 2013 or later, and that A1 contains the text PH;V;O the formula below should work
=SUM(COUNTIFS(A2:P2;FILTERXML("<c><e>"&SUBSTITUTE(A1;";";"</e><e>")&"</e></c>";"//e")))
(this will have to be entered as an array formula if you don't have dynamic arrays)
I have a list of data that can be seen in this example:
https://docs.google.com/spreadsheets/d/1bRiupsmjfDRE9AgcM_5KJKAyxYKpQiMuyAGSoGaZYN0/edit?usp=sharing
Range A:B is the given data
Range D:E is the desired result
It is very easy to solve it without array formula. But Is there any array formula that can work it out? I need array formula so that i dont have to drag again and again when the data is added below.
use:
=INDEX({A:A, IF(A:A="",, VLOOKUP(ROW(B:B),
IF(B:B<>"", {ROW(B:B), B:B}), 2))})
For column B, put in C1
=ArrayFormula(lookup(row(B:B),row(B:B)/if(B:B<>"",1,0),B:B))
A certain cell is part of a range containing an array formula (created using CTRL-SHIFT-ENTER). Other than my brute force method of visually examining the formula in the certain cell, does Excel have a command that will highlight the range of cells which contain the array formula? For instance, assume C10 has the following array formula ={TRANSPOSE(myarray)}, how can I ask Excel to highlight the range of cells that will receive the contents of the transposed "myarray"?
This feels like a Excel 101 question but my search has been futile.
If there is no "junk" below the array formula, something like:
=COUNTA(C10:C9999)
Without using VBA, is there any way to find and output the results missing from one array compared to another into cells.
I have two sheets, on Sheet1 is a list of numbers in column B and "N/A" In column J if we are done with them. On Sheet2 is we paste a list of numbers in column B. I need to be able to find the numbers missing from Sheet2 that do not have an "N/A" tag in Sheet1 and output them to column C.
I tried {=INDEX(Sheet1!B:B,MATCH(1,(Sheet1!B:B<>B:B)*(Sheet1!J:J<>"N/A"),0))} but (Sheet1!B:B<>B:B) doesn't seem to be doing what i think it should. I understand that the above formula won't give more than 1 result yet. I would need to add something to eliminate the results already in column C, but one step at a time.
Sheet1!B:B<>B:B compares corresponding cells in two sheets. Unless the numbers appear at the same exact rows in both sheets, your code will not work.
I don't think it is possible to deal with this with array formula, because Match doesn't accept an array as its first argument. But you can enter this in C1 and copy and paste to the whole column:
=IF(ISERROR(MATCH(Sheet1!B1,Sheet2!B:B,0)),IF(Sheet1!J1<>"N/A",Sheet1!B1,""),"")
There will be empty cells though.