Lookup and match reference in other WS

BravoBravoAu

Board Regular
Joined
Nov 8, 2011
Messages
64
Office Version
  1. 2016
Platform
  1. Windows


Hi guys,


Hopefully an easy one – I often struggle withtroubleshooting the lookup function of excel.




I have a workbook with two worksheets:





  1. Employee details (WS1)
  2. Bank deposits (WS2)


Each month, I need to paste in bank deposit information intoWS2. I would like to be able to displaythe employee surname in WS2 based on the matching employee ID listed in thebank deposits (7-digit number) against the employee ID recorded in WS1.



WS1




<tbody> [TD="width: 208, bgcolor: transparent"] Employee ID [/TD]
[TD="width: 208, bgcolor: transparent"] Name [/TD]
[TD="width: 208, bgcolor: transparent"] 1234567 [/TD]
[TD="width: 208, bgcolor: transparent"] Brown [/TD]
[TD="width: 208, bgcolor: transparent"] 2345678 [/TD]
[TD="width: 208, bgcolor: transparent"] Arnold [/TD]
</tbody>


WS2



<tbody> [TD="width: 104, bgcolor: transparent"] Date [/TD]
[TD="width: 104, bgcolor: transparent"] Description [/TD]
[TD="width: 104, bgcolor: transparent"] Debit [/TD]
[TD="width: 104, bgcolor: transparent"] Credit [/TD]
[TD="width: 104, bgcolor: transparent"] Balance [/TD]
[TD="width: 104, bgcolor: transparent"] Employee lookup [/TD]
[TD="width: 104, bgcolor: transparent"] 15 Jul 18 [/TD]
[TD="width: 104, bgcolor: transparent"] 2345678 [/TD]
[TD="width: 104, bgcolor: transparent"] [/TD]
[TD="width: 104, bgcolor: transparent"] $1,236.00 [/TD]
[TD="width: 104, bgcolor: transparent"] $2,157.25 [/TD]
[TD="width: 104, bgcolor: transparent"] [/TD]
[TD="width: 104, bgcolor: transparent"] 13 Jul 18 [/TD]
[TD="width: 104, bgcolor: transparent"] 1234567 [/TD]
[TD="width: 104, bgcolor: transparent"] [/TD]
[TD="width: 104, bgcolor: transparent"] $523.00 [/TD]
[TD="width: 104, bgcolor: transparent"] $921.25 [/TD]
[TD="width: 104, bgcolor: transparent"] [/TD]
</tbody>


So in WS2, I am trying to get F2 to display ‘Arnold’ and F3to display ‘Brown’. Obviously these aresimplified versions of WSs with hundreds of rows.


Help? Thanks inadvance.


 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
In F2 of Bank Deposits enter and copy down:=VLOOKUP(B2,'Employee details'!A:B,2,0)
Thanks @Aladin. I can replicate your solution and make it work, however in the 'live' data, I seem to have an issue which I hadn't mentioned resulting in a #N/A error.The Employee ID in WS1 Column A is derived from another WS. The formula is WS1 Column A obtains the seven digits from WS3 column C by virtue of =RIGHT(cell reference,7). While WS1 Column A is formatted as number, its not 'matching' against the same number in WS2 column B. Can you follow my ramblings?
 
Upvote 0
Aladin- you helped me with the same problem in 2016. I thought the +0 option fixed my problem. I've since learned it doesn't all of the time. Most of the time it works but sometimes in doesn't. I've made sure the formatting is consistent, etc. I've taken lines where it worked and painted the format to entire columns, without success. It doesn't see to be a formatting issue. I've made sure the versions of Excel are the same. I can't think of any reason for VLOOKUP not to work. Do you have any other ideas? Thank you.
 
Upvote 0
Aladin- you helped me with the same problem in 2016. I thought the +0 option fixed my problem. I've since learned it doesn't all of the time. Most of the time it works but sometimes in doesn't. I've made sure the formatting is consistent, etc. I've taken lines where it worked and painted the format to entire columns, without success. It doesn't see to be a formatting issue. I've made sure the versions of Excel are the same. I can't think of any reason for VLOOKUP not to work. Do you have any other ideas? Thank you.

=VLOOKUP(IF(ISNUMBER(B2+0),B2+0,B2),'Employee details'!A:B,2,0)

This tries the capture the following scenario:

B2 is available column A as either number or as text.

Care to post the VLOOKUP formula you struggle with yourself?
 
Upvote 0
[TABLE="width: 192"]
<colgroup><col><col><col></colgroup><tbody>[TR]
[TD] A
Work Order Number[/TD]
[TD]WO[/TD]
[TD]D4[/TD]
[/TR]
[TR]
[TD="align: right"]4770526[/TD]
[TD="align: right"]4770526[/TD]
[TD="align: right"]0

[/TD]
[/TR]
</tbody>[/TABLE]
Columns are A, B & C. Formula in 3rd column (C1) is =IF(ISNA(vlookup(a1,b$1:b$1425,1,false)),0,vlookup(a1,b$1:b$1425,1,false))
Thank you!
 
Upvote 0
[TABLE="width: 192"]
<colgroup><col><col><col></colgroup><tbody>[TR]
[TD] A
Work Order Number[/TD]
[TD]WO[/TD]
[TD]D4[/TD]
[/TR]
[TR]
[TD="align: right"]4770526[/TD]
[TD="align: right"]4770526[/TD]
[TD="align: right"]0

[/TD]
[/TR]
</tbody>[/TABLE]
Columns are A, B & C. Formula in 3rd column (C1) is =IF(ISNA(vlookup(a1,b$1:b$1425,1,false)),0,vlookup(a1,b$1:b$1425,1,false))
Thank you!

The formula you have should return 4770526, not 0.

1. Check whether Calculation Options are set to Automatic.

2. If you get #N/A (therefore 0) for A1 and A1 is a true number, then b$1:b$1425 must have it as text number. Then the following should succeed:

=VLOOKUP(A1&"",B$1:B$1425,1,FALSE)

3. If you get #N/A (therefore 0) for A1 and A1 is a text number, then b$1:b$1425 must have it as true number. Then the following should succeed:

=VLOOKUP(A1+0,B$1:B$1425,1,FALSE)

4. The following considers both possibilities:

=IFERROR(VLOOKUP(A1&"",B$1:B$1425,1,FALSE),IFERROR(VLOOKUP(A1+0,B$1:B$1425,1,FALSE),"not found"))
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,915
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top