This one is tricky. VLookup but return a different cell value

edjohn20

New Member
Joined
Mar 5, 2024
Messages
34
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
Okay, so I am using Vlookup to compare two tables. For argument sake I am comparing two addresses. If they match the vlookup simply returns the same address as the matched address. This is where I am stuck. I need to return a location number for the matching address instead. For the life of me I cannot figure this out. I know it should be easy but I can't seem to get the logic right for excel. Here is some data to work with.

Formula for VLookup: =VLOOKUP(D70,'Update sysID'!G$1:G$8953,1,FALSE) This compares the address in my table (columnD) to the table array "Update sysID" and when it finds a matching address it just displays it. In Update sysID table, column F contains an ORGID that I want to display instead. How would the formula work? So lets say that it finds the address in row 3234 and the addresses match then I want it to return the value for F3234 instead of the matching address in G3234. The data is all contained in the same workbook. The vlookup is located on "address match" sheet
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Not sure I'm reading it right, but would XLOOKUP work?

=XLOOKUP(D70,'Update sysID'!G$1:G$8953,'Update sysID'!F$1:F$8953,FALSE)

This would look for the value in D70 in sysID column G and returns the matching value in column F
 
Upvote 0
Solution
Not sure I'm reading it right, but would XLOOKUP work?

=XLOOKUP(D70,'Update sysID'!G$1:G$8953,'Update sysID'!F$1:F$8953,FALSE)

This would look for the value in D70 in sysID column G and returns the matching value in column F
Ah, yes that does work!!! now how would I take it one step further. Let's say the value in D1 is not found at all and I want to compare a different column such as C1 and if that is found then display matching value from F
 
Upvote 0
I did this, it seems to work

=XLOOKUP(C1,'Update NamsysID'!G$1:G$8953,'Update NamsysID'!F$1:F$8953,XLOOKUP(D1,'Update NamsysID'!G$1:G$8953,'Update NamsysID'!F$1:F$8953),FALSE)
 
Upvote 0
I did this, it seems to work

=XLOOKUP(C1,'Update NamsysID'!G$1:G$8953,'Update NamsysID'!F$1:F$8953,XLOOKUP(D1,'Update NamsysID'!G$1:G$8953,'Update NamsysID'!F$1:F$8953),FALSE)
That is the reverse of what you previously indicated.
That formula looks for C1 first and if that fails looks for D1. Based on you previous post you want it the other way around ie look for D1 first if that fails look for C1.

The alternate lookup utilises the "if_not_found" position.
=xlookup(lookup_value, lookup_array, return_array, if_not_found)
 
Upvote 0
That is the reverse of what you previously indicated.
That formula looks for C1 first and if that fails looks for D1. Based on you previous post you want it the other way around ie look for D1 first if that fails look for C1.

The alternate lookup utilises the "if_not_found" position.
=xlookup(lookup_value, lookup_array, return_array, if_not_found)
yeah it is, while running it i decided I wanted to compare c before d for better results
 
Upvote 0

Forum statistics

Threads
1,224,811
Messages
6,181,081
Members
453,021
Latest member
Justyna P

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