I'm trying to figure out how to deal with situations when using Excel's match formula where there is more than one match. In the below example, in cell C3 (formula spelled out in D3) we are matching ID = 1 in array A3:A8 and getting the match's row number back. In this example there are two matches of ID = 1 (cells A3 and A7) and XLS returns the first ID of 1 it finds, which is row 1 in the array A3:A8 (or cell A3). However I'd like the match formula to return the match that has the lowest associated "Value", which would be the ID of 1 that is in the 5th row of this array (cell A7) which has an associated Value of 9. Any ideas how to do this?
Hello Please try this:
=MATCH(MINIFS(D4:D9,C4:C9,E4),D4:D9)
Result:
I'm having an trouble making an excel formula at the moment which would get first search for the row, column value and then return the row number from which I can get the another column value in the same row.
Right now, I've made this function. =INDEX('Rent'!$D$2:$D$73, MATCH(0, ($B$6='Rent'!$B$2:$B$73)*($C$7='Rent'!$A$2:$A$73),0))
Here rent is another sheet, and first i'm searching for the particular value like $B$6 here in first MATCH function by searching for the value in 'Rent' sheet's column and then same for next check. The resulting match would contain bow $B$6 and similarly $C$7 in the same row and then I want to return the value of another column value in the same row.
Please, let me know how can I do this. I've been stuck at this a long time.
The rent sheet looks like this:
Based on your data, I think you can just use SUMIFS for this:
=SUMIFS('Rent'!$D$2:$D$73,'Rent'!$B$2:$B$73,$B$6,'Rent'!$A$2:$A$73,$C$7)
I have five columns in Excel and I want to return the maximum value's column heading name. However, there are cases where the max values are repeated more than once for the same row. So, I am trying to return both column names.
The green values are the min and red are the max. In row 4, it is clearly there is more than one Max with same value, I would like to return B and E in the stream cell.
I tried this formula in Excel using the index:
=IF(ISNUMBER(A6),INDEX($B$5:$F$5,1,MATCH(L6,B6:F6,0)),"")
MATCH returns the first match, so I think you need something gross like the following (I started with the first column and row, but you can shift the column numbers -- the rows are designed to be draggable)
=IF(ISNUMBER(F2),IF(F2=A2,$A$1,"")&IF(F2=B2,$B$1,"")&IF(F2=C2,$C$1,"")&IF(F2=D2,$D$1,"")&IF(F2=E2,$E$1,""))
You can use FILTER() to return multiple values. In this example, I've concatenated them with TEXTJOIN():
In cell E2 enter the formula =MAX(A2:D2). In cell F2 enter =TEXTJOIN(,,FILTER(A$1:D$1,A2:D2=E2)). Copy down.
I'm after a way to a cell to check another cell that I'm inputting text into, and for it to see if that text value is the same anywhere else in the column, and if so, it grabs the number value which is in the same column as itself but in the row of the text that checked for.
So if you use picture, you can see I've currently got E7 selected. I'm wanting it to check the "GOLF COURSE" column for any other row that contains the same text it has in it's own row. For this it's "Course1". I'd like it to check through the rest of column B if there are any matches for "Course1" which there is in B3. If it matches I'm wanting it to then use the value that's in same column as it (E) but the same row as the matched text in column B. In this case I would want it to copy the value that is in E3.
If there wasn't a match (as it's a new course lets say) then I need to be able to just click on the cell and input the numbers needed, which I would be able to do anyway but just throwing it in for sake of info.
I've tried all sorts of googling and thinking how I could possibly do it but it's too difficult for my amateur knowledge of Excel.
I believe you are looking for INDEX/MATCH:
=IF(COUNTIF($B:$B,$B7)>1,INDEX(E:E,MATCH($B7,$B:$B,0)),"New")
I added a COUNTIF check to ensure that the same course exists more than once in column B, without it, you would be getting a circular reference formula (which would also happen with the above formula if the same course appears more than once, but you use this formula on the first occurrence of that course, so make sure do not use it the first time you fill out the PAR scores for a particular course).
Merged Cells Messing With INDEX/MATCH
The Formula
Copy the following formula into cell E7:
=IF(AND($B7<>"",$D7="Par"),IF(ISERROR(MATCH($B7,$B$3:$B5,0)),"Par",INDEX(E$3:E5,MATCH($B7,$B$3:$B5,0))),IF(AND($B6<>"",$D7="Strokes"),IF(ISERROR(MATCH($B6,$B$3:$B4,0)),"Strokes",INDEX(E$3:E4,MATCH($B6,$B$3:$B4,0)+1)),""))
Image
How
We are creating the formula in cell E7.
MATCH
Syntax: MATCH(lookup_value,lookup_array,match_type)
We will use MATCH to find the position of COURSE1 in the above
cells of column B.
The 1st argument is lookup_value which will be the cell in the same
row of our row (7) in column B: B7 where we will lock only the
column (we will not be searching in other columns): $B7.
The 2nd argument lookup_array will be a range. The first cell will be
cell B3 whose row and column we'll lock, because we will always
start the search from this cell in every other cell to the left or
below: $B$3. The last cell will be B5 where we will lock only the
column: $B5.
And finally we will use 0 as the parameter of the 3rd argument
match_type to find an exact match.
Now were ready to write our MATCH formula:
=MATCH($B7,$B$3:$B5,0)
Which will return 1 i.e. an exact (0) match of B7 was found
in the 1st cell of range B3:B5.
We don't want 1 (E3), but the value in the cell (5).
INDEX
The INDEX function has 2 syntaxes where we will use the 2nd:
Syntax 2: INDEX(reference,row_num,column_num,area_num)
Since were using a one-column range we can safely omit the arguments row_num and column_num, which leaves us with:
Modified Syntax: INDEX(reference,area_num)
The INDEX function used this way will return the area_num-th value
of reference i.e. in our case if area_num is 1 it will return the
1st value in our column range, if it is 2, then the 2nd, etc.
The 1st argument reference will be the same sized range of our
MATCH range in column E: $E$3:$E5 where we will remove the
column locks because we also want to return results for other
columns: E$3:E5.
The 2nd argument area_num will be our MATCH formula.
Our current formula looks like this:
=INDEX(E$3:E5,MATCH($B7,$B$3:$B5,0))
which will return the value of cell E3: 5.
Final Adjustments: IF, AND and ISERROR
That would have been almost (Error Checking) all if the cells in column B weren't merged. Therefore we have to use IF to determine if the row in which we're writing the formula contains either Par or Strokes and adjust our so far created formula for both conditions:
=IF($D7="Par",INDEX(E$3:E5,MATCH($B7,$B$3:$B5,0))
=IF($D7="Strokes",INDEX(E$3:E4,MATCH($B6,$B$3:$B4,0)+1)
=IF($D7="Par",INDEX(E$3:E5,MATCH($B7,$B$3:$B5,0)),$D7="Strokes",INDEX(E$3:E4,MATCH($B6,$B$3:$B4,0)+1))
and (3rd condition) check in column B if there is a value in the row where we're creating the formula for a row containing Par, or the row above for a row containing Strokes, using AND:
=IF(AND($B7<>"",$D7="Par"),INDEX(E$3:E5,MATCH($B7,$B$3:$B5,0)),IF(AND($B6<>"",$D7="Strokes"),INDEX(E$3:E4,MATCH($B6,$B$3:$B4,0)+1),""))
Finally we have to add some error checking, because if the match was not found the formula will produce and #N/A error:
=IF(AND($B7<>"",$D7="Par"),IF(ISERROR(MATCH($B7,$B$3:$B5,0)),"Par",INDEX(E$3:E5,MATCH($B7,$B$3:$B5,0))),IF(AND($B6<>"",$D7="Strokes"),IF(ISERROR(MATCH($B6,$B$3:$B4,0)),"Strokes",INDEX(E$3:E4,MATCH($B6,$B$3:$B4,0)+1)),""))
Now we are ready to copy the formula to the right and below as far as we need.
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.