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)
Related
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 some data in an Excel sheet.
Is there a way to write a formula that's only in cell B1 (cells B2:B7 are blank), that will duplicate the values in A1:A7 to the range B1:B7, using Excel's "spilling" feature for functions that return arrays?
My first idea was to use "=A1:A7", but that just copies the value from the formula's row in column A to the cell with the formula, without affecting the other cells.
Use
=A1:A7
You will need to format the resulting cells as you want. Formula will not copy formatting and will not replace the existing formatting in the cells.
If your version does not have the dynamic array spill capabilities (Excel 2019 and older). Then one will need to array enter the formula or just drag a formula down.
To array enter we select a range the same size and shape as the target and put the above formula in the formula bar:
Then we confirm the formula with Ctrl-Shift-Enter and Excel will fill the formula down the range:
But this can also be done by putting =A1 in B1 and dragging it down. Older version require a formula in each cell that one expects an output. There is no "Spill" feature in older versions.
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")))
Let's say I have in B2 the formula =ROW(A1:A3). This formula gives an array of {1;2;3}. Because a cell only holds one value, cell B2 displays a value of 1. Any place in the worksheet, the formula =B2 gives 1, not the array. Yet, Excel still remembers the array because the formula is still in B2.
Is there any way to get the array back so it, the whole array, not its individual elements, can be used for further manipulation? I'm looking for something like OPERATION(B2) = {1;2;3}. For example, SUMPRODUCT(OPERATION(B2)) = SUMPRODUCT(ROW(A1:A3)) = 6.
As a workaround, you can store your formula in Name Manager, e.g.:
Then you can use it as a reference in Excel formulas, like =INDEX(Rows,2,1):
I realize that this is not the answer to the OP's question as they do not have the latest Office 365. I put this here for those who come later and do have it.
With the latest Office 365 with Dynamic array formulas this problem is now gone.
Putting =ROW(1:3) or the equivalent dynamic array formula =SEQUENCE(3) Excel will spill the array down automatically without the need of Ctrl-Shift-Enter:
And now one can refer to the array by only refering to A1 by putting # after the reference:
=SUM(A1#)
Then no matter how the array in A1 changes the other formula does not need to be changed.
The caveat is that the formula in A1 needs the room to spill down. If there is a cell that has anything in it that resides in the spill down array it will return an error.
Just to try and clarify this, arrays in Excel before the September 2018 update for Office 365 don't self-expand like they do in Google sheets, so if you put an array into a single cell you just get the first element of the array (see column A for example).
If you want to enter the array directly into the sheet, you have to select the cells you want it to occupy (say B2:B4) and enter it as an array formula (see column B) using CtrlShiftEnter
You can still use the array in another formula as long as it's expecting an array - e.g. with sumproduct you get the correct total, 6 (see column C).
=SUMPRODUCT(ROW(A1:A3))
Unfortunately this doesn't always work without entering the whole formula as an array formula (see column D).
=SUM(ROW(A1:A3))
EDIT
#JvDV is correct, you don't always get the first element of an array expression entered into a single cell - see this reference for explanation of the implicit intersection mechanism.
I have two methods, which might qualify as solutions or workarounds, depending on what technology you're willing to accept.
Both rely on retrieving the formula that produces the array from B2 and then evaluating that formula each time you invoke your OPERATION(B2).
Method 1: VBA
Create a UDF:
Function Arr(R as Range)
Arr = Application.Evaluate(R.Formula)
End Function
which you then invoke in a cell, e.g. =SUM(Arr(B2)).
Method 2: Name Manager + EVALUATE()
Note that this is different from Justyna's answer. The idea is to allow you to specify the address of the cell holding the array-generating formula.
Create a name that holds =EVALUATE(FORMULATEXT(INDIRECT(INDEX($1:$1048576;ROW();COLUMN()+1)))). This way you can specify that you want the content of the cell B2 by writing the string B2 to the nearest cell to the right of the cell in which you're using your newly created name.
Unfortunately, EVALUATE() cannot be used within a cell.
I have an array formula that looks like this:
{=SUMIF(C11:C23,budgets,F11:F23)}
What I want it to do is sum cells F11:F23 where cells C11:C23 are values within the named range budgets.
Right now budgets has two values: 10361 and 10300 (these are transaction codes). However, the formula seems to only work for the first code 10361 but not for the second one.
I don't want to use SUMIFS because I have multiple worksheets where I would like this array formula to work, and the codes may change so changing them in one place (the named range budgets) will make things easier.
Any ideas? I don't know VBA, so was hoping for a formula solution.
Use SUMPRODUCT with COUNTIF():
=SUMPRODUCT((COUNTIF(budgets,$C$11:$C$23)>0)*$F$11:$F$23)
Or you can use this array formula:
=SUM(SUMIF(C11:C23,budgets,F11:F23))
Being an array it needs to be entered with Ctrl-Shift-Enter when exiting edit mode instead of Enter. If done properly Excel will put {} around the formula.