I have a long dataset of increasing and decreasing values and I am trying to find the length of the longest sequence of values which increase one after the other.
I know this is easily done with a helper column however I am hoping there is a formula which can do it by itself.
TIA
Consider the array formula:
=MAX(FREQUENCY(IF(A1:A99<A2:A100,ROW(A1:A99)),IF(A1:A99>A2:A100,IF(A1:A99<>A2:A100,ROW(A1:A99)))))+1
Array formulas must be entered with Ctrl + Shift + Enter rather than just the Enter key. If this is done correctly, the formula will appear with curly braces around it in the Formula Bar.
NOTE:
I would always use a "helper" column for this kind of task rather than this array formula.
Related
I'm trying to find a way to get the max number of characters after the decimal place in a given column. For example
I found this to get the max length in a column (using ctrl+shift+enter):
=MAX(LEN(A1:A5))
And this formula to get the number of characters after the decimal for a single cell:
=LEN(A1)-FIND(".",A1)
But I need to combine the two into a single formula so that I don't need another column of data. Is this possible without VBA?
Edit, one example I might encounter would be 99.999 vs 100.12 that I'd need to differentiate between and result in a length of 3 characters after the decimal.
If any of your data is the result of formulas, you may have some surprising results and need to use VBA. Otherwise, so long as the format is General, you can use
=MAX(LEN(A1:A5)-FIND(".",A1:A5&"."),0)
confirmed by holding down ctrl+shift while hitting enter
You can use Array Formulas in conjunction with some of your original suggestions to accomplish this. The formula in the example you provided would be:
{=MAX(IFERROR(LEN(B1:B3)-FIND(".",B1:B3),0))}
Some notes:
The "IFERROR" function is used to return a 0 to the MAX function if the "." is not found in the string
Array formulas can be entered into excel by entering the text "=MAX(IFERROR(LEN(B1:B3)-FIND(".",B1:B3),0))" into the formula bar and pressing ctrl+shift+enter (at which point the curly brackets will appear)
Applying this formula should yeild the following results for your sample inputs:
Sample Results
I am trying to count the occurrences of certain character within a range. I.E. If I have several cells with words in them I want to count the number of times Capital letter "A" appears.
The most common answer I find (even on this site) is
=SUM(LEN(F59:F73)-LEN(SUBSTITUTE(F59:F73,"A","")))
This particular formula only seems to count the first cell in the range and no others. Why is this happening when it seems to be quite the universal answer?
You either need to array enter the formula using Ctrl Shift Enter, or change the SUM to be a SUMPRODUCT to force array calculation without having to array enter the formula:
=SUMPRODUCT(LEN(F59:F73)-LEN(SUBSTITUTE(F59:F73,"A","")))
I'm indexing a table that somehow has numbers stored as text, here is a fragment:
{0\0\0\0\"110"\950\0\0\0\"3485"\0\0\0\"950"\0\0\0\0\0\100}
When I try to use sumifs for this range, i get wrong values. Is there any way to fix this in formula without changing the data?
This is the exact formula I'm using:
=SUMIFS(INDEX(INDIRECT("'"&"P_"&$C$3&"'!B9:BC100");MATCH($D6;INDIRECT("'"&"P_"&$C$3&"'!BC9:BC100");0););INDIRECT("'"&"P_"&$C$3&"'!B1:BC1");L$1))
You cannot use SUMIFS but there's a work-around.
Something like:
So if you have data like above, enter this array formula:
=SUM(IF(INDIRECT("A3:A5")=A$2,VALUE(INDIRECT("B3:B5"))))
by pressing Ctrl + Shift + Enter.
300 is entered as Text but you still get the correct total for all items equal to A$2 which is A.
Note: My local separator is , (not ; as in your example) so don't be confused.
Also, above is just an example, I'll leave the actual adaptation of your formula to you. HTH.
If you have ranges with numbers stored as text a good way to deal with this is to multiply your cells by 1 as you use them. Example below. You need to leave out the curly braces and press Ctrl+Shift+Enter to enter the formula, which tells excel to individually multiply each number by 1 before summing them (in my example)
Therefore, you might try the following formula with your data
{=SUMIFS(INDEX(INDIRECT("'"&"P_"&$C$3&"'!B9:BC100")*1;MATCH($D6;INDIRECT("'"&"P_"&$C$3&"'!BC9:BC100")*1;0););INDIRECT("'"&"P_"&$C$3&"'!B1:BC1");L$1))}
Note: I haven't tested this formula, but I did test that this method works with INDIRECT()
I want to use the Index formula to list data in my excel sheet.
I want to list the data of the column A that contains "finished" in the corresponding cells in column E.
Currently I'm using the following formula:
=INDEX(IMs!A:A;MATCH("finished";IMs!E:E;0))
The problem is, only the first value appears. I want to list ALL of them.
Is it possible with the vlookup formula?
Thank you very much in advance.
Kind regards,
Vanessa
First enter this formula in B1:
=COUNTIF(IMs!$E:$E,"Finished")
Then enter this array formula** in your first cell of choice:
=IF(ROWS($1:1)>$B$1,"",INDEX(IMs!$A$1:$A$1000,SMALL(IF(IMs!$E$1:$E$1000="finished",ROW(IMs!$E$1:$E$1000)-MIN(ROW(IMs!$E$1:$E$1000))+1),ROWS($1:1))))
Copy this formula down (though not the one in C1) until you start to get blanks for the results.
If the upper row reference that I chose (1000) is not sufficiently high, then change it as required. Note, however, that since this is an array formula, it is not recommended that you make this upper bound too high (and certainly don't reference entire columns!), since this will have a significantly detrimental effect on spreadsheet performance.
From your post, it also appears that you are using a version of Excel in which the argument separator in formulas is not the comma but the semi-colon. If this is indeed the case then you will need to make the necessary amendments to the formulas I provided.
Regards
**Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).
I have % values in cells A1:A60 (sum = 100%). I want to find out what range (starting from A1 downwards) will get me closest to 50%.
For example if Sum(A1:A32)=0.482 and Sum(A1:A33)=0.52, I would want it to return range A1:A32 (in actual fact, I'd want it to return the value 32 that represents the bottom of this range).
This formula needs to be repeatable over many such 1-dimensional ranges, so a 'solve' method isn't really what I'm after. I'm hoping for a tidy formula in a single cell for each range.
Many thanks!
P.S. Please assume the distribution of data within each range is random
Best I can do is this array formula**:
=MATCH(TRUE,ABS(B1-SUBTOTAL(9,OFFSET(A1,,,ROW(A1:A60)-MIN(ROW(A1:A60))+1,)))=MIN(ABS(B1-SUBTOTAL(9,OFFSET(A1,,,ROW(A1:A60)-MIN(ROW(A1:A60))+1,)))),0)
where B1 contains your desired threshold, e.g. 0.5.
Regards
**Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).