I have this code to get row number from 5 to 400.
ROW(INDIRECT("5:400"))
When I highlighted the whole thing and hit F9, I got an array ranging from 5 to 400. However, when I highlighted "INDIRECT("5:400")" and hit F9 I got an error message saying "Formula is too long..."
I wonder why it's so.
Presume you have nothing entered in Row 5, the following formulas will try to return 16,384 units of 0 separated by comma sign , for Row 5 in a single formula when you press F9
=5:5 or =INDIRECT("5:5")
The maximum characters can be shown by a single formula is 8192 as shown below so it explained why excel is unable to return the value behind your INDIRECT formula, which is trying to return 16,384 x 396 times of of zero plus comma 0, (presume they are all empty) in a single formula.
FYI 16,384 is the maximum columns of an excel worksheet. See Excel specifications and limits.
Related
I have a small data set of 2 columns and several rows (columns A and B)
I want to return each instance of codeblk 3 in a formula that is elsewhere in my sheet, (so a vlookup is out as it only shows the first instance) if it does not appear then a message to say its not there should come up.
I have the formula partially working but i cant see the reason why its not displaying the values.
My formula is as below:
This is an array
{=IF(ISERROR(INDEX($A$55:$B$70,SMALL(IF($B$55:$B$70=3,ROW($B$55:$B$70)),ROW(1:1))-1,1)),"No value's produced",INDEX($A$2:$C$7,SMALL(IF($B$55:$B$70=3,ROW($B$55:$B$70)),ROW(1:1))-1,1))}
The result that shows up is only "No values produced" but it should reflect statement B, C and D in 3 separate cells (when changing ROW(1:1), ROW(2:2) etc)
{=SMALL(IF($B$56:$B$69=4,ROW($B$56:$B$69)),ROW(1:1))} - This produces the result 68 which is the correct row.
Any ideas?
Thanks,
This is an array formula - Validate the formula with Ctrl+Shift+Enter while still in the formula bar
=IFERROR(INDEX($A$55:$B$70,SMALL(IF($B$55:$B$70=3,ROW($B$55:$B$70)-54),ROW(1:1)),1),"No value's produced")
The issue you are facing is that your index starts it's first row on $B$55, you need to offset the row numbers in the array to reflect this. For example, the INDEX contains 16 rows but if you had a match on the first row you are asking for the 55th row from that INDEX(), it just can't fulfil that.
EDIT
The offset was out of sync as your original formula included another -1 outside of the IF(), I also left an additional bracket in play (the formula above has now been edited)
The ROW() function will essentially translate $B$55:$B$70 into ROW(55:70) which will produce the array {55;56;57;58;59;60;61;62;63;64;65;66;67;68;69;70} so the offset is needed to translate those row numbers in to the position they represent in the indexed data of INDEX().
The other IF() statement then produces and array of {FALSE;2;3;4;FALSE etc.
You can see these results by highlighting parts of the formula in the formula bar and hitting F9 to calculate.
Please find bellow one issue I am encountering with AGGREGATE function: I don't succeed to make formula ignoring hidden rows
Imput data:
column B (B3:B500) --> text strings in the format of next Example :
24 ± 6 (18...30) μm
Desired Output Data:
by formula only (not by vba)
in this range, search the values between the "..." and the close parenthesis (equivalent of 30 from our example)
return max of all cells
don't take into account hidden rows/filtered cells
My solution:
isolate text between "..." and close parenthesis ")" using MID & FIND
transform text to number (multiplying by *1)
apply AGGREGATE(14;7;RANGE;1)
14 = large (max)
7 = ignore error and hidden cells
The encountered problem:
I don't succeed to make formula ignoring hidden rows (I always get the same result for max, event I manually hide the row with the max value)
FORMULA
=AGGREGATE(14;7;(MID(B3:B500;FIND("...";B3:B500)+3;FIND(")";B3:B500)-FIND("...";B3:B500)-3)*1);1)
Does anybody have an explanation for this issue ?
Thank you in advance for your attention.
I don't think there is anything wrong with your formula as such, but it may be failing because ... can be inserted as a single character … code 133 in which case your formula should be
=AGGREGATE(14,7,(MID(B3:B500,FIND(CHAR(133),B3:B500)+1,FIND(")",B3:B500)-FIND(CHAR(133),B3:B500)-1)*1),1)
EDIT Scott is correct, you would have to use a helper column to ignore hidden rows.
See the documentation here where it says that AGGREGATE will not ignore hidden rows if they are part of a calculation.
Here is a comparison of the direct calculation hiding row 10 (which contains 60) with the calculation using a helper column.
I'm trying to calculate the standard deviantion from a population and was using the STDEV.P function to do this. But when I inserted it into a cell, the resulting answer was 0. When I looked into the Function window, it gave an (more resonable) answer (around 7600).
=STDEVPA(IF(Tests!H:H = "Motion",Tests!D:D))
How can I make sure the cell also gives the right answer
Sample data:
24 1.46791E+12 1.46791E+12 31544 FALSE TRUE FALSE Still 2 1 3 2 6
1 1.46729E+12 1.46729E+12 26515 FALSE FALSE TRUE Motion 1 1 1 2 4
You should not be using full column references with an array formula¹. Your sample formula was calculating two columns of 1,048,576 rows.
The following will cut the ranges down to the minimum number of rows required. Data starts in row 2.
=STDEVPA(IF(Tests!H2:INDEX(Tests!H:H, MATCH(1E+99,D:D ))="Motion", Tests!D2:INDEX(Tests!D:D, MATCH(1E+99,D:D ))))
Remember to finish with CSE¹. A single matching row will return zero.
¹ Array formulas need to be finalized with Ctrl+Shift+Enter↵. If entered correctly, Excel with wrap the formula in braces (e.g. { and }). You do not type the braces in yourself. Once entered into the first cell correctly, they can be filled or copied down or right just like any other formula. Try and reduce your full-column references to ranges more closely representing the extents of your actual data. Array formulas chew up calculation cycles logarithmically so it is good practise to narrow the referenced ranges to a minimum. See Guidelines and examples of array formulas for more information.
I have column A that is full of numbers ranging from 0 to 100. How can I get the index of the bottom element, but which is bigger than 0.
For example
6
7
9
1
0
8
0
In this example the number returned should be "6", as it's the index of the cell that contains "8".
You want to use the array form of MATCH():
=MATCH(1E+99,IF($A$1:$A$7<>0,$A$1:$A$7))
Being an array it needs to be confirmed with Ctrl-Shift-Enter when exiting edit mode instead of Enter. If done properly excel will put {} around the formula.
This will find the last number in the range that is not 0.
If your list is not static, the list changes length, then you can use this formula which will grow and shrink as the data in column A changes:
=MATCH(1E+99,IF($A$1:INDEX(A:A,MATCH(1E+99,A:A))<>0,$A$1:INDEX(A:A,MATCH(1E+99,A:A))))
It is still an array and being an array it needs to be confirmed with Ctrl-Shift-Enter when exiting edit mode instead of Enter. If done properly excel will put {} around the formula.
Array formula's calculations are exponential and therefore we want to limit the size of the dataset being tested to the extents. The two INDEX(A:A,MATCH(1E+99,A:A)) find the last cell in Column A with a number and sets that as the last cell in the range.
I am having problems getting a total from a row of cells that contain both numbers and text, I have tried a couple of different formulas now and they don't fix it.
I have 5 cells in a row which reference a sum total in a separate workbook which I then add text on to:
='K:\Folder 1\Surveys\Returned Surveys[00001.xlsm]00001'!$D$15 & "/18"
At first my had just =SUM(K4:O4) but this just returned 5 instead of the sum total of the row.
I then tried to find the number within the text with the following formula:
=LEFT(FIND("/",K4)-1+(FIND("/",L4)-1+(FIND("/",M4)-1+(FIND("/",N4)-1+(FIND("/",O4))))))-1
However, this just returns #VALUE.
In a last ditch attempt I tried to convert the values into text and then add them but this also just returns the number of cells rather than the total value:
=TEXT(K4,0)&"/18" and then the above =LEFT formula.
Select your 5 cells and use a simple equals formula in each. Example:
='K:\Folder 1\Surveys\Returned Surveys[00001.xlsm]00001'!$D$15
With the five cells selected, tap Ctrl+1. When the Format Cells dialog opens, go to the Number tab. Choose Custom from the list down the left and supply the following for the Type:,
0\/18
... or,
0\/12
Click OK. Your numbers will look like they have /12 or /18 tacked on the right side but the underlying values are still the raw numbers from the external workbook. Sum them using any conventional means you want (r.g. =SUM(K4:O4) or =K4+L4+M4+N4+O4).
Your formula would have worked as,
=LEFT(K4, FIND("/", K4)-1)+LEFT(L4, FIND("/", L4)-1)+LEFT(M4, FIND("/", M4)-1)+LEFT(N4, FIND("/", N4)-1)+LEFT(O4, FIND("/", O4)-1)
The following image shows your method (concatenate then split) in row 4 and mine (custom number format and sum) in row 5.
Text defaults to left-alignment and true numbers default to right-alignment.