VLookup Issue with returning value if multiple

ronie85

Board Regular
Joined
Jan 25, 2014
Messages
106
Office Version
  1. 365
Platform
  1. Windows
Hi, I am hoping someone can rewrite my Vlookup formula.

The formula is currently =IFERROR(VLOOKUP(B176,'Material Purchasing'!$B$2:$E$999999,4,FALSE),"")
And the purpose of the formula is to search for a PO Number (B176) within the range of Material Purchasing'!B2:B999999 and return a value Material Purchasing'!E2:E999999, which it does.
However, this range Material Purchasing'!E2:E999999 may contain more than 1 value for which I would prefer the original =IFERROR(VLOOKUP(B176,'Material Purchasing'!$B$2:$E$999999,4,FALSE),"") formula to show an error for which I can then check it manually.

Would someone know of an easy fix for which it will only return a value if Material Purchasing'!E2:E999999 only has one output and not multiple?
 
i'm thinking as you have 365 version

=IFERROR(ROWS(UNIQUE(FILTER(B3:E8,B3:B8="PO-10110")))=1,"")
with AN IF()

=IFERROR(IF(ROWS(UNIQUE(CHOOSECOLS(FILTER('Material purchasing'!$B$2:$E$999999,'Material purchasing'!$B$2:$B$999999=B176),1,4)))=1,VLOOKUP(B176,'Material purchasing'!$B$2:$E$999999,4,FALSE),"ERROR"),"")

should work

Formula in D176 - just for simplicity

if B176 - DOES NOT EXIST , Then a blank
otherwise AND ERROR if B176 and E176 not all the same


Book1
ABCD
173
174
175
176PO-10110ERROR
177
178
Supplier Payments
Cell Formulas
RangeFormula
D176D176=IFERROR(IF(ROWS(UNIQUE(CHOOSECOLS(FILTER('Material purchasing'!$B$2:$E$999999,'Material purchasing'!$B$2:$B$999999=B176),1,4)))=1,VLOOKUP(B176,'Material purchasing'!$B$2:$E$999999,4,FALSE),"ERROR"),"")


Book1
ABCDE
1
2
3PO-1011018JN1089
4PO-1011029JN1089
5PO-1011037JN1089
6PO-101104JN1089
7PO-10110PO-10110x
8JN1089
9
Material purchasing


the sample spreadsheet will only be on dropbox for a few days
 
Upvote 0

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

Forum statistics

Threads
1,225,190
Messages
6,183,446
Members
453,160
Latest member
DaveM_26

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