Vlookup with conditions / when there are multiple results

Koala123

New Member
Joined
Apr 13, 2019
Messages
24
Office Version
  1. 365
Hi pros, wondering if anyone can help?

I want to search IDs in tab 1, from tab 2 (the below pic) and return to AccountNumber values. As you can see one ID could have multiple results, some status are "NULL" and some are "1".

I understand that Vlookup will return to the first result it finds, which in my case could be an AccountNumber marked as "NULL".

Basically we need values with "1" when there are multiple identical IDs, if a ID is unique then we can disregard the status, then it will be a normal Vlookup, but when there are multiple results Vlookup may return to a "NULL" AccountNumber which is not we want.

What should I do to make sure it always return to AccountNumber marked as "1" when there are multiple results? Thanks heaps!

Capture.PNG
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
I understand that you want to skip NULL rows, but I see that ID 80048412 has two rows, both with a 1.
Which one do you want?
 
Upvote 0
I understand that you want to skip NULL rows, but I see that ID 80048412 has two rows, both with a 1.
Which one do you want?
Hi Dermot, it doesn't matter as long as it's 1, just want to skip NULL. NULL rows are also ok when ID is not multiple.
 
Upvote 0
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Also what should happen with IDs like 80048412 which have multiple accounts with 1 in the status column?
 
Upvote 0
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Also what should happen with IDs like 80048412 which have multiple accounts with 1 in the status column?
Hi Fluff, I use Microsoft Office 365.

Sorry I should have summarized all conditions, the result I would like to achieve is:

1. ID with multiple accounts, including both NULL and 1 : avoid NULL, return to 1 <----------- this is why I raised this question
2. ID with multiple accounts, all with 1: all acceptable
3. ID with only one account : all acceptable regardless status
3. ID with multiple accounts, all with NULL: all acceptable ( I think we don't have this scenario but just in case)
 
Upvote 0
When there are multiple accounts that are acceptable, do you just want to pull the 1st one?
 
Upvote 0
I think it can be done quite simply
First sort the data on the Status column, which will push the NULLS to the bottom. Then just do a VLOOKUP
You can do this in one formula by doing the sort in a LET variable first, then doing VLOOKUP on the result
 
Upvote 0

Forum statistics

Threads
1,223,902
Messages
6,175,278
Members
452,629
Latest member
SahilPolekar

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