# Pricing based on multiple factors

#### jeffamore

##### New Member
Hi all... having some trouble getting this to work the way I'd like. Please refer to the worksheet image... it's the best way for me to explain what I'm trying to do.

I want to look at the first three characters in the Indicator column (column A), look at the appropriate table that matches that value in columns F and G, grab the correct dollar amount in that table from column G based on the number of units in column B that corresponds to the number in column F, and then multiply B and F in column C. I've included the expected results for rows 2-9 in columns J and K. This would be done over thousands of rows and will be repeated several times with different variations, so I only want to do this once and just be able to copy the formula all the way down column C. Any help is greatly appreciated!

#### Attachments

• Excel Example.JPG
216.6 KB · Views: 10

### Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

#### Misca

##### Well-known Member
Welcome to the board!

I'd start solving this by creating named ranges for each of those lookup tables: Select the cells F3:G7 and in the address bar write something like Range101. Once you've named all your lookup ranges using the same pattern you can use the following formula:
=VLOOKUP(B2,INDIRECT("Range"&LEFT(A2,3)),2)*B2

The INDIRECT function turns text to a range reference. Thus "Range"&LEFT(A2,3) refers to the named range "Range101". The rest of the formula is just a basic VLOOKUP.

You can name your ranges pretty much whatever you want to as long as it's a single word and it doesn't start with a number. The named range can't overlap an existing cell address so something like "Rng101" doesn't work.

There's at least a couple more ways I could solve this but this method is by far the easiest to read and maintain.

#### jeffamore

##### New Member
Welcome to the board!

I'd start solving this by creating named ranges for each of those lookup tables: Select the cells F3:G7 and in the address bar write something like Range101. Once you've named all your lookup ranges using the same pattern you can use the following formula:
=VLOOKUP(B2,INDIRECT("Range"&LEFT(A2,3)),2)*B2

The INDIRECT function turns text to a range reference. Thus "Range"&LEFT(A2,3) refers to the named range "Range101". The rest of the formula is just a basic VLOOKUP.

You can name your ranges pretty much whatever you want to as long as it's a single word and it doesn't start with a number. The named range can't overlap an existing cell address so something like "Rng101" doesn't work.

There's at least a couple more ways I could solve this but this method is by far the easiest to read and maintain.
This works perfectly and should be so easy to maintain and modify as needed. Thank you so much!

Replies
9
Views
130
Replies
10
Views
127
Replies
4
Views
170
Replies
8
Views
174
Replies
7
Views
134

1,128,129
Messages
5,628,869
Members
416,347
Latest member
AT2021

### 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.

### Which adblocker are you using?

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

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