Frage

Using vlookup, when a match occurs, I want to display the value of column C from sheet 2 from the same row where the match occurred. The formula I came up with takes the value from column C sheet 2 but it takes it from the row where the formula is pasted on sheet 3 instead of where the match occurred.

Here's my formula that doesn't work:

=IF(VLOOKUP(Sheet1!A:A,Sheet2!A:A,1,FALSE),Sheet2!C:C,"NODATA")

How can I take the value from the row where the match occurred?

War es hilfreich?

Lösung

You need to manually get the index you're looking for, then get the value at that index:

=INDEX(Sheet2!C:C, MATCH(Sheet1!A:A,Sheet2!A:A,FALSE))

Andere Tipps

To be clear, I am not entirely certain I understand what you are trying to achieve. Maybe the following helps...

Suppose I have 3 sheets in a workbook as follows:

    Sheet1            Sheet2                 Sheet3
    A                 A    B    C            A     B
1   10                2    h    Apple        10    Apple
2   20                g    4    Banana       25    n/a
3   30                l    !    Pear         40    Grape
4   40                g    *    Grape        30    Pear

In column B of Sheet 3 I have the following formula:

=INDEX(Sheet2!$C$1:$C$4,MATCH(VLOOKUP(A1,Sheet1!$A$1:$A$4,1,FALSE),Sheet1!$A$1:$A$4,1))

To explain:

  • The VLOOKUP looks up the value from Sheet 3, Col A in Sheet1
  • The MATCH returns the row in Sheet1 of the VLOOKUP result
  • The INDEX then uses the row number to pick the right value from the value in Sheet2

Again, not sure if this is what you wanted exactly. It may help you get you started...

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top