Data must have 1 PO Number per 1 Vendor

WascoWarrior

New Member
Joined
May 22, 2024
Messages
9
Office Version
  1. 365
Platform
  1. Windows
Not sure how to check for this?
1720557080712.png


In the above example, row 5 is invalid because that vendor number was already used in the previous PO.
Row 7 is invalid because that PO was already used with vendor # 5216.
Was thinking of using another field with an OFFSET but not sure how to code.
Suggestions?
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Assuming:
Your table on the screenshot starts on column A
and PONumbers are sorted then

you can use this formula on H2 (or any empty column starting on row 2)
Excel Formula:
=IF(OR(INDEX(A:A,MATCH(B2, B:B, 0))<>A2, VLOOKUP(A2, A:B, 2, FALSE)<>B2), "Invalid", "")

EDIT:
I see your data starts on Row 3, so paste this formula on Row 3 of any available empty column:
Excel Formula:
=IF(OR(INDEX(A:A,MATCH(B3, B:B, 0))<>A3, VLOOKUP(A3, A:B, 2, FALSE)<>B3), "Invalid", "")
 
Upvote 0
Solution
Another option:
Excel Formula:
=IF(ROWS(UNIQUE(FILTER($A$3:A3,$B$3:B3=B3)))>1,"Invalid","Valid")
 
Upvote 0
Assuming:
Your table on the screenshot starts on column A
and PONumbers are sorted then

you can use this formula on H2 (or any empty column starting on row 2)
Excel Formula:
=IF(OR(INDEX(A:A,MATCH(B2, B:B, 0))<>A2, VLOOKUP(A2, A:B, 2, FALSE)<>B2), "Invalid", "")

EDIT:
I see your data starts on Row 3, so paste this formula on Row 3 of any available empty column:
Excel Formula:
=IF(OR(INDEX(A:A,MATCH(B3, B:B, 0))<>A3, VLOOKUP(A3, A:B, 2, FALSE)<>B3), "Invalid", "")
 
Upvote 0
Code works great! I wrapped it around an IFERROR so I don't get #N/A on a failed lookup as I copied the formula down the column.
Also modified the code since the PO started in column B.
=IFERROR(IF(OR(INDEX(B:B,MATCH(C3, C:C, 0))<>B3, VLOOKUP(B3, B:C, 2, FALSE)<>C3), "Invalid PO/Vendor", ""),"")
 
Upvote 0

Forum statistics

Threads
1,221,773
Messages
6,161,855
Members
451,724
Latest member
sledparty

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