How to take lookup values from different sheets and show appropriate result?

Viewed 64

How do I take the lookup value from different sheets in a workbook and show it corresponding results. Here is the link to a sample file

Basically, the first three sheets contain a table with headers ID, Name, Basic, DA, HRA, Gross, Incentive with different values for each row in the column. Now in sheet4 when I put a value for the ID column the vlookup should check in which sheet this value is present and according to that it should show its Gross column value and so on..

For example if I enter a value of C005 in the ID field in sheet4, the result in the Gross field should be 6420, if I enter a value of A002 in the ID field in sheet4, the result in the Gross field should be 8774 and so on...

I tried to do something like =IF(LEFT(A2,1)=A,VLOOKUP($A$2,Sheet3!$A$1:$G$13,6,0),IF(LEFT(A2,1)=B,VLOOKUP($A$2,Sheet2!$A$1:$G$13,6,0)),IF(LEFT(A2,1)=C,VLOOKUP($A$2,Sheet1!$A$1:$G$13,6,0))) but it is showing error and most importantly it is very long and complicated.

Can anyone help?

1 Answers

This is the formula you need

I am using INDIRECT and CONCATENATE

=VLOOKUP(A1,INDIRECT(CONCATENATE("Sheet",IF(LEFT(A1,1)="A",1,IF(LEFT(A1,1)="B",2,"")), "!$A$1:$H$16")),1,FALSE)

Data I have in Sheet1

enter image description here

Data I have in Sheet2

enter image description here

The magic in Sheet3

enter image description here

Related