Insert variable into formula

Brutalic

New Member
Joined
Aug 13, 2012
Messages
4
Hello everyone, I have a question regarding variables in formulas, I'll just give you the data for my exact case.
So I have a drop down list on the first page in the D column, which gets its data from a different worksheet (in my case named TIV). In the TIV worksheet there are also prices listed for each element that is in the drop down list. What I want to do is to get the prices to change accordingly, when I select random elements from the drop down list.

I tried to enter them manually;

=IF(ISNUMBER(FIND(TIV!B12;D34));TIV!G12; ... and so on to IF(ISNUMBER(FIND(TIV!B86;D34));TIV!G86;

If i enter them manually the huge formula actually works, but it is only up to 64 elements, and here i have 72!
Is there any way to tell Excel to connect B12-G12 up to B86-G86? Like making a variable X (12-86) and writing BX GX or something, I'm not sure.

Any ideas?
Thanks, Luka.
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Hi Brutalic,

Assuming that the cell with the dropdown (I assume you're using validation to create the dropdown) is cell B2, then in cell C2 use =IFERROR(VLOOKUP(B2,Sheet2!B2:C6,2,FALSE),"") which uses the vlookup function to return the value, the iserror function merely ensures that if there is no information in B2 that the cell then shows blank rather than #NA. Usefully the validation will be based on the list in cells B2:B6 on sheet2 with the prices in C2:C6.

Hope this helps.
 
Upvote 0
Hi Brutalic,

Assuming that the cell with the dropdown (I assume you're using validation to create the dropdown) is cell B2, then in cell C2 use =IFERROR(VLOOKUP(B2,Sheet2!B2:C6,2,FALSE),"") which uses the vlookup function to return the value, the iserror function merely ensures that if there is no information in B2 that the cell then shows blank rather than #NA. Usefully the validation will be based on the list in cells B2:B6 on sheet2 with the prices in C2:C6.

Hope this helps.

Thanks, I will try this when I get into work on Thursday. I'll leave some feedback whether or not it worked, or maybe some additional questions :). Thanks again.
 
Upvote 0
Hi Brutalic,

Assuming that the cell with the dropdown (I assume you're using validation to create the dropdown) is cell B2, then in cell C2 use =IFERROR(VLOOKUP(B2,Sheet2!B2:C6,2,FALSE),"") which uses the vlookup function to return the value, the iserror function merely ensures that if there is no information in B2 that the cell then shows blank rather than #NA. Usefully the validation will be based on the list in cells B2:B6 on sheet2 with the prices in C2:C6.

Hope this helps.

It worked, I had to customize the formula a little bit, but you pointed me in the right direction, thanks a lot!
 
Upvote 0

Forum statistics

Threads
1,215,514
Messages
6,125,272
Members
449,219
Latest member
daynle

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