Complicated (for me) Lookup or Compare

LCTrucido

Board Regular
Joined
Apr 29, 2011
Messages
88
Hey folks,

I've got another one for the genius residents of this fine forum. At work I run a report that creates an excel file. I've already created a master with the VBA required to clean it up so the process will be run the query, paste into the master, then run the macros and save the results.

In the master there will be a sheet with a list of SKU's in column B. In columns E - Z there are possible location codes where those SKU's are supposed to be stored, but different SKU's will have different amounts of possible locations. Some may have one, others may use the full range. In either case, each row will contain a unique SKU identifier followed by some number of location codes. This sheet will not change is and used for reference. Example:

GradeSKUDescriptionNameLocation1Location2Location3
Gold123456BlahBlah1Blah1100.A.1100.A.2100.A.3
Silver234567BlahBlah2Blah2200.A.1200.A.2
Bronze345678BlahBlah3Blah3300.A.1

<tbody>
</tbody>


When I export my data and trim it, it will show an itemized list of barcodes, the SKU of the item, and the current location code. What I'm trying to do is add a formula or VBA to the data dump to reference the above sheet and say whether or not a line item in the report is in an allowed location. Example:

BarcodeSKUDescriptionCurrent LocationLocation Good?
10000123456BlahBlah1100.A.2Yes
20000234567BlahBlah2200.A.3Nope
30000345678BlahBlah3300.A.1Yes

<tbody>
</tbody>

Thoughts?
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
@LCTrucido, what are the ranges (including headers) of the two above grids? Or, if they are formatted as tables, what are the table names?

Each table is symbolic of the format of their respective and separate worksheets. Assume A1 for the first header label. The master list that doesn't change is in a worksheet called SKU INFO, the data dump sheet is DATA.
 
Upvote 0
In DATA!E2 and copied down as far as needed:

Code:
=IF(ISNUMBER(MATCH(D2,OFFSET('SKU INFO'!$E$1,MATCH(B2,'SKU INFO'!B$2:B$5000,0),0,1,22),0)),"Yes","Nope")

Adjust the B$2:B$5000 bottom range to accommodate the max number of rows in your actual 'SKU INFO'! sheet.

(Though it'd be more flexible if you formatted each range as an official table.)
 
Last edited:
Upvote 0
It functions, but not quite as expected. I'm out of my depth on the Match and Offset but using the data above the first and third entries should return positive results since their current locations are withing the allowed locations for those SKU's. The second would be negative as the current location is not on the list.

This formula returns negative on all three entries.
 
Upvote 0
If Current Location for a SKU in DATA matches any location for that SKU in SKU INFO, return Yes. If not, Nope.
 
Upvote 0
@LCTrucido, it's possible that your office uses an older version of Excel that doesn't support ISNUMBER(). If you'd like to post your office version of Excel here, I or someone else can adapt the formula to work with the version you have.
 
Upvote 0
@LCTrucido, it's possible that your office uses an older version of Excel that doesn't support ISNUMBER(). If you'd like to post your office version of Excel here, I or someone else can adapt the formula to work with the version you have.

I think that was the issue at home, I have an older version there. Here at the office with 2013 it's working great.
 
Upvote 0

Forum statistics

Threads
1,215,216
Messages
6,123,669
Members
449,114
Latest member
aides

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