Excel - Formula to find consecutive column that fulfills condition & Return Column Header - excel

I'm having trouble for formula to return column value. Where the number 1 has appeared 2x in a row, in this case need for fill formula for Column C.
While for column B I have used the Max Frequency formula
need formula in Column C
Thanks in advance

You could use Excel's texts functions; first CONCAT all cells with '0' and '1' (from you range), then FIND first occurrence of '11' (and arithmetic add +1 to the result) and you have desired number of week.
Now last more CONCAT with text 'Week_' and optional wrap it all with IFERROR to not show error output if occurrence of '11' is not found.
Excel formula (without IFERROR):
CONCAT("Week_",FIND(11,CONCAT(D2:M2))+1)
Be aware that all cells in searched range D2:M2 must be non empty (either it has be '0' or '1')

Related

Get row index of the nth valid numeric value in a column

I have a spreadsheet with the column A2:A7 filled as:
A2=A4=A5=< blank>; A3=3; A6=a; A7=4;
How to get the row index of the second numeric value of the column A? In this case "6" (6th row from my data set that start in A2 and refers to A7).
In the same example, if I fill A2=0, the formula should return "2".
I need to use just Excel formulas, I can't use VBAs of macro codes.
Use this:
{=SMALL(IF(ISNUMBER($A$2:$A$7)*ROW($A$2:$A$7)=0,"",ROW($A$2:$A$7)),2)-1}
The 2 close to the end will determine if you interested in the nth smallest numeric value. In this case the 2nd.
Note that it's an array formula entered through CtrlShiftEnter

Excel: SUMIFS multiple criteria formula error

I am trying to sum over a range under multiple conditions, that should ALL be fulfilled in order to give the sum as result. There are 3 columns (C,D,H) and one table. The conditions are:
C=header of the table. (both C values and the header are characters, in "general" format, cell O2653)
last 5 characters of D = hour (left column of the table, first cell M2656, once the formula works I would like to scroll down on the following hours)
first 3 characters of D = last 3 characters on a second header of the table (cell N2654)
the formula is
=SUMIFS($H$2657:$H$2676;$C$2657:$C$2676;$O$2653;right($D$2657:$D$2676;5);$M$2656;left($D$2657:$D$2676;3);right($N$2654;3))
When I enter it, I receive the error: "there's a problem with this formula. Not trying to type a formula? When the first character is an equal (=) or minus (-) sign, Excel thinks it's a formula...."
This are the columns, plus column H where there are numerical values (e.g. 8):
I have tried enter combinations like ctrl+shift+enter, or to insert text within "" instead of the single cell in the criteria (maybe it was a range problem), but nothing worked.
Why is this occurring? Thank you for your help

Count number of blank cells in row between last cell and next non-blank cell

Is it possible (with a formula preferably) to count the number of blank cells in row, where the counting starts at a given column and counts going backward (e.g. right to left) the number of blank cells until a non-blank cell is found? In the example below, the counting begins at Column H and proceeds leftward. Using COUNTA or COUNTIF seem like reasonable tools to use, but I am unsure on how to terminate the counting once a non-blank cell is found.
You can use something like this if the values in your table are all text:
=COUNTBLANK(INDIRECT(CHAR(97+MATCH("zzzz",B2:H2))&ROW()&":H"&ROW()))
MATCH("zzzz",B2:H2) returns the column number in which the last non-blank cell is.
CHAR(97+ column number) returns the letter of that column.
Append it to the row number to give the reference where the COUNTBLANK has to start with &ROW()
&":H"&ROW()) gives the reference of the last cell, which is H plus the row number.
INDIRECT turns the concatenated text into a range that Excel can evaluate.
Try this formula
=COLUMNS(B2:H2)-MATCH("zzzz",B2:H2)
You could use nested if statements
=IF(ISBLANK(H2),IF(ISBLANK(G2),IF(ISBLANK(F2),IF(ISBLANK(E2),IF(ISBLANK(D2),IF(ISBLANK(C2),IF(ISBLANK(B2),IF(ISBLANK(A2),8,7),6),5),4),3),2),1),0)

Excel VLOOKUP N/A error

I have a table setup like this:
I am trying to do a lookup, where Column D value matched one of the Column A values and returns Column C value.
The numbers in column A and D are stored as text.
My formula is VLOOKUP(F3,A1:C3,3,TRUE) but this returns "Value not available error". What is wrong with the formula?
EDIT
Figured out that some of the values were stored as general.
Now the problem is that I have to get an exact match with leading zeroes.
For example in Column D I have "27154" but in Column A I have "000027154", these should match.
But if I have "000271540" or any other variant in Column A, it should not match.
All the numbers in Column A are 9 digits long with leading zeroes where needed.
VLOOKUP(TEXT(F3, "000000000"),A1:C3,3,FALSE)
It will require creating the same value for the VLOOKUP to find the value. Looking at your example, the length of the text in column A is 9 characters. As a result, the padding is applied which will be used to search. To make it exact match, FALSE is used as last argument to VLOOKUP.
You can use wildcards in VLOOKUP:
=VLOOKUP("*"&F3,A2:C3,3,FALSE)
There's nothing wrong with the formula. The problem is that the value in A2 is text and treated as text when comparing to the number in F3.
If you can't change your values in column A, then you can use this array formula:
=SUM((F3=VALUE(A2:A3))*(C2:C3))
Enter with CTRL+SHIFT+ENTER
This will convert the values in A2:A3 as numbers for the comparison against F3.

Check the number of unique cells in a range

I have an excel sheet.
Under column E, I have 425 cells with data. I want to check if the same data (i.e. text inside the cell) is repeated anywhere else in any of the remaining 424 cells under column E. How do I do this?
For example, in E54 I have
Hello Jack
How would I check this value to see if it was in any other of these cells?
You could use
=SUMPRODUCT(1/COUNTIF(E1:E425,E1:E425))
to count the number of unique cells in E1:425
An answer of 425 means all the values are unique.
An answer of 421 means 4 values are duplicates of other value(s)
Use Conditional Formatting on all the cells that will highlight based on this formula:
COUNTIF(E:E,E1) <> 1
This is based on the column being E, and starting on E1, modify otherwise.
In Excel 2010 it's even easier, just go into Conditional Formatting and choose
Format only unique or duplicate values
If you have to compensate for blank cells, take the formula supplied above by #brettdj and,
Adjust the numerator of your count unique to check for non-blanks.
Add a zero-length string to the COUNTIFS's criteria arguement.
=SUMPRODUCT((E1:E425<>"")/COUNTIF(E1:E425,E1:E425&""))
Checking for non-blank cells in the numerator means that any blank cell will return a zero. Any fraction with a zero in its numerator will be zero no matter what the denominator is. The empty string appended to the criteria portion of the COUNTIF is sufficient to avoid #DIV/0! errors.
More information at Count Unique with SUMPRODUCT() Breakdown.
This formula outputs "unique" or "duplicates" depending if the column values are all unique or not:
{=IF(
SUM(IF(ISBLANK(E1:E425),0,ROW(E1:E425)))
=
SUM(IF(ISBLANK(E1:E425),0,MATCH(E1:E425,E1:E425,0)))
,"unique","duplicates")}
This is an array formula. You don't type the enclosing {} explicitly. Instead you enter the formula without {} and then press cmd-enter (or something else if not a Mac - go look it up!) If you want to split your formula over multiples lines for readability, use cmd-ctrl-return on a Mac.
The formula works by comparing two SUM() results. If they are equal, all the nonblank entries (numeric or text) are unique. If they are not equal there are some duplicates. The formula does not tell you where the duplicates are.
The first sum is what you get by adding up the row numbers of every non-blank entry.
The second sum does a lookup of each nonblank entry using MATCH(). If all entries are unique, MATCH() finds each entry at its own position, and the result is the same as the first sum. But if there are duplicate entries then a later duplicate will match an earlier duplicate and the later duplicate will contribute a different value to the sum, and the sums won't match.
You might have to adjust this formula:
if you want cells containing "" to count as blank, then use LEN(...)=0 for ISBLANK(...). I suppose you could put other tests in there if you wanted, but I have not tried that.
if you want to test an array not starting at row 1, then you should subtract a constant from ROW(...).
if you have a huge column of cells, you might get integer overflow when computing this sum. I don't have a solution to that.
It's a shame that Excel does not have an ISUNIQUE() function!
This may be a simpler solution. Assume column A contains data in question. Sort on that column. Then, starting in B2 (or first non-blank cell, use the following formula:
=IF(A2=A1,1,0).
Than sum on that column. When sum = 0, all values are unique.
highlight E and on the home tab select conditional formatting > Highlight Cell Rules > Duplicate Values...
It will then highlight everything that is repeated.

Resources