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

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

Related

Referencing parameter lookup_array in function match in excel

I want to use the match function in Excel the following way: match(True, D2:J2>=K1,0), to find the smallest value that is greater than or equal to lookup_value. My problem is how to change the row number in the array, since the row number is on his part the result of a match function.
Thanks for the help in advance!
Your baseline formula is:
=MATCH(TRUE,D2:K2>=K1,0)
which looks at row #2:
To change that row, lets put 7 in cell A1 to mean use row #7. We change the formula to:
=MATCH(TRUE,INDEX(D:D,A1):INDEX(K:K,A1)>=K1,0)
So the value in A1 defines the row that MATCH() should use.
EDIT#1:
Here is another example of using INDEX() to return a cell reference.
Say we have data in column A. We want the user to be able to select parts of the column (start and stop rows) and sum the part. However, we don't want the user to tinker with the formula. In fact we are going to lock the formula cell so the user can't destroy the formula. We tell the user to put the start row in D1 and the end row in D2.
We put the formula in cell D3:
=SUM(INDEX(A:A,D1):INDEX(A:A,D2))

Using logical operators to determine cell value is greater than one before and after

I have a a column of data in an Excel sheet and want to filter those values where a cell has a value greater than the previous or the next cell. eg for ColumnA my logic is:
If (A2>A1 & A2>A3)
Then B2=1
Else B2=0
I need to execute it for 1,000 rows in column A so something like:
if(currentcellnum value > currentcellnum-1 value and currentcellnum> currentcellvaluve+1)
then print in adjacent column of current cell 1 else 0.
A bit shorter than #Uberzen1's (first) answer:
=(A2>A1)*(A2>A3)
Type these formulas in cell B2 and drag down as far as you need them:
if you want to return 1 when the value is greater than both:
=IF(AND(A2>A1,A2>A3),1,0)
if you want to return 1 when the value is greater than either:
=IF(OR(A2>A1,A2>A3),1,0)

SUMPRODUCT - return a row number

I am trying to return the row number in which a sheet Column matches a value AND another column in that same sheet matches a value AND yet another column in that same4 sheet matches a value.
Here is some code:
=SUMPRODUCT((Data!C:C=Total!$A5)*(Data!A:A=Total!E35)*(Data!B:B=Total!F35)*(ROW(Data!C:C)-1))
Where Data!C:C is a column of dates and Total!$A5 is a cell with the same format type date
And Data!A:A is a column of unique text values and Total!E35 is a cell with a text value
AND Data!B:B is a column of unique text values and Total!E35 is a cell with a text value
There is only one match for the given combination I described.
I am stuck on the latter part of the formula, I believe. Where I multiply the ROW(Data! blah blah blah...
Can somebody help?!
If you want to return a row number MATCH might be better, i.e. this "array formula"
=MATCH(1,(Data!C:C=Total!$A5)*(Data!A:A=Total!E35)*(Data!B:B=Total!F35),0)
confirmed with CTRL+SHIFT+ENTER

Excel vlookup return not available

i want to fill the name column using vlookup, here is my transaction table
and here is my master file
yes, they're the same number, but why do my vlookup doesn't return the corresponding name based on looked up value ?
does vlookup comply with data type ? like text, or number, or general ?
i have changing the data type, over and over, and return the same "Not Available"
is there anything wrong with my excel 2007 ?
You should use Index/Match like this:
=INDEX(Phonebook!$A$2:$A$45,MATCH(B2,Phonebook!$B$2:$B$45,0))
Your Vlookup doesn't work, because it tried to find value from B2 in first column of range Phonebook!$A$2:$B$45, i.e. Phonebook!$A$2:$A$45
What's wrong is that VLOOKUP is looking for the phone number in the first column, meaning in column A. For 'backwards lookup', you will need to use INDEX and MATCH:
=INDEX(Phonebook!$A$2:$A$45,MATCH(B2,Phonebook!$B$2:$B$45,0))
INDEX is as follows:
=INDEX(Range, Row Number, [Column Number])
It will return the value a cell from the range Range that is on the row number Row Number and column Column Number. I have put Column Number between square brackets because it is optional (you have only 1 column if you have a range that is within A:A for example)
To get the row number, you can use MATCH like the above. It works a bit like VLOOKUP, but instead of returning the value of the matching cell, it returns the row number of the matching cell (or column number if you use it on a horizontal range).
MATCH(B2,Phonebook!$B$2:$B$45,0) thus looks for B2 in the range B2:B45 of the worksheet Phonebook (0 stands for exact match) and gives the row number.
Then, you tell Excel to return the value of the cell from the range Phonebook!$A$2:$A$45 and row number obtained from MATCH.

Understanding the vlookup formula in Excel?

I have two lists in the spreadsheet and some of the names match and some do not.
I need a formula so that where the text matches it can assign the corresponding value.
For example: in B2 it would read a 0 or false because there is no Jimmy T. in the C column. However, in B3 the formula should work as if the text in A3 matches any text in the C column it assigns the corresponding D value that is directly to the right. So, in B3 the answer would be 47.33.
The ultimate goals is for the value in the B column to correspond with Column A the same way that column C corresponds with column D.
And where there is not a value for column A to have it read "False" in column B.
Type on B2:
=VLOOKUP(A2,$C$2:$D$7,2,FALSE)
then, drag the formula down to the other cells on column B. The vlookup formula has four arguments (see explanation below).
To have the word "False" appearing where no match is found upgrade to the following formula:
=IFERROR(VLOOKUP(A2,$C$2:$D$7,2,FALSE),"False")
This is a example about the above formula's output.
Basically, what the vlookup function does is:
to find a match for the specified cell (first formula argument),
given an array of values (second argument). The leftmost column in the array must have the values to be matched with the formula's first argument),
and if there is a match it returns the values from one specific column of this array (third formula argument). In the above example we want to return the second column of the specified array.
The last argument on the vlookup formula returns the value for an approximate match (TRUE) or for an exact match (FALSE).

Resources