Multi-criteria vlookup within VBA

cornflakegirl

Well-known Member
Joined
Nov 4, 2004
Messages
2,023
Hi everyone, I'm being a bit dense this afternoon, so would appreciate your help.

I have a spreadsheet with three columns. Column A is Brand, column B is Channel, column C is Measure. I'm trying to write some code to change some of the entries in columns B/C according to certain rules.

I have a table in a different spreadsheet that specifies these rules. It's a named range. The first column is Brand. The second column is current channel, the third is new channel. The fourth column is current measure, the fifth is new measure.

I want the code to match the brand, current channel and current measure, and then set the values in column B / C (of the original spreadsheet) to the new channel and new measure. Just to complicate things slightly, most of the lines in the named range table don't have a current or new channel, as they need the measure changing regardless of what the current channel is (and the channel doesn't need changing).

I thought some sort of concatenated VLOOKUP initially, and then I thought a loop - but I can't think of a good way to make a loop work within a named range. I may possibly be overthinking!

Can anyone help, please?
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

Forum statistics

Threads
1,224,560
Messages
6,179,520
Members
452,921
Latest member
BBQKING

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