Shorter Formula Possible?

dcofer

Board Regular
Joined
Jun 25, 2004
Messages
203
Hello All,

I am using the formula below to lookup a price based upon two variables, the type of wood, and the size of the pieces.

The type of wood that is being looked up is in cell G21 and there are seven possible types (Ali Posts, Ironbark, Kwila, etc.) and the size to be looked up is in G22. Based upon the type of wood, there are different sizes available. As you can see from the ranges, one wood type only has 4 sizes, one has 9 sizes and the others have 10 sizes. To complicate matters even more, the ranges of data that contains the wood type, sizes, and prices are in separate areas. The prices are not contained in one large table or range. For example, the prices for Ironbark are in D28 to E37 on a seperate sheet and the prices for Redwood are in L28 to M36.

The formula below works perfectly, but it is very long and convoluted. Is there a simplier way to look up the prices? Perhaps with a shorter formula?

I tried to make the ranges of prices a table, but since there are blank rows (because all types of wood do not have 10 sizes), the data would not go into a table, and a Pivot Table was not possible for the same reason.

If anyone knows a better way to accomplish the lookup, I would appreciate it. Again, this formula works, but I am looking for a simplier formula, if one exists.


=IF(G21="Ali Posts",VLOOKUP(G22,Sheet2!B28:C31,2,0),IF(G21="Ironbark",VLOOKUP(G22,Sheet2!D28:E37,2,0),IF(G21="Kwila",VLOOKUP(G22,Sheet2!F28:G37,2,0),IF(G21="Merbau",VLOOKUP(G22,Sheet2!H28:I37,2,0),IF(G21="Radiata Pine",VLOOKUP(G22,Sheet2!J28:K37,2,0),IF(G21="Redwood",VLOOKUP(G22,Sheet2!L28:M36,2,0),IF(G21="Steel",VLOOKUP(G22,Sheet2!N28:O37,2,0))))))))


Thanks,

David
 
MrKowz,

Sorry, but that formula also returns a #N/A error message. To answer your questions, no, there is no data below the area being searched, and the sizes are all numbers and formatted as such. They are numbers such as 50, 60, 70, 90, 100, etc. There is no text in the sizes, only numbers.


mancemonster, your formula worked perfectly. That is so much shorter and simplier than what I had.

I knew there had to be a beter way than the nested IF formula I was using.

Thanks guys for all your help, and all the time you put into it, especially MrKowz.

David
 
Upvote 0

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Elaborating on what MrKowz has started with...

=VLOOKUP(G22,OFFSET(Sheet2!$B$28,0,MATCH(G21,Sheet2!$B$27:$O$27,0)-1,ROWS(Sheet2!$B$28:$O$37),2),2,0)
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,756
Members
452,940
Latest member
rootytrip

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