mardi 6 janvier 2015

Display column header value if data is being pulled from specific column

I have two sheets in my workbook – Sheet1 and Sheet2.


Sheet1 has two columns and six rows.



A B
1 [MARK] [LUCY]
2 100 120
3 200 220
4 300 320
5 400 420
6 500 520

[Sheet1]


Sheet2 has two columns that I'm attempting to pull data into from Sheet1 using an IF statement and VLOOKUP.


In cell Sheet2-A2 I am pulling in a reference from any cell in Sheet1 from row 2 down. So the following example will pull in the value of 100:



A B
1 [VALUE] [NAME]
2 =Sheet1!A2
3
4
5

[Sheet2]


In Sheet2-B2 i'm trying to include an IF statement that says:


IF value in cell Sheet2-A2 is pulling from Sheet1-ColumnA, then print the value MARK in cell Sheet2-B2.

IF value in cell Sheet2-A3 is pulling from Sheet1-ColumnB, then print the value LUCY in cell Sheet2-B3.

IF value in cell Sheet2-A4 is pulling from Sheet1-ColumnA, then print the value MARK in cell Sheet2-B4.



And so on, so the result looks something like this:



A B
1 [VALUE] [NAME]
2 100 MARK
3 220 LUCY
4 400 MARK
5 520 LUCY

[Sheet2]


I'm not sure if VLOOKUP is the right way to do this so any help would be appreciated. Thanks!


Aucun commentaire:

Enregistrer un commentaire