copy data using formula in excel

2019-08-29 01:40发布

Please help, I have this situation. I am not sure how to solve with vlookup, if anyone can guide me that would be great help.

County  Status  Status Count
dublin  In      2   
dublin  out     1
dublin  closed  10
donegal closed  2
donegal in      5

Sheet 2 with

County  Economy     EconomyCount
dublin  good growth  23
dublin  average      15
donegal not good     14

I want result as

County  Status  Status Count    Economy     EconomyCount
dublin  In      2               good growth  23
dublin  out     1               average      15
dublin  closed  10              N/A       
donegal closed  2               not good     14
donegal in      5               N/A

标签: excel
1条回答
叛逆
2楼-- · 2019-08-29 02:29

Considering your Sheet1 is as

enter image description here

and Sheet2 is

enter image description here

Assuming you are matching for the first occurrence, then in Cell D2 of Sheet1 enter the formula

=IF(COUNTIF($A$2:$A2,$A2)=1,INDEX(Sheet2!$B$2:$B$3,MATCH($A2,Sheet2!$A$2:$A$3,0)),"N/A")

and in Cell E2 of Sheet1 enter the following formula

=IF(COUNTIF($A$2:$A2,$A2)=1,INDEX(Sheet2!$C$2:$C$3,MATCH($A2,Sheet2!$A$2:$A$3,0)),"")

Drag/Copy down as required. See image for reference.

enter image description here

查看更多
登录 后发表回答