Forum Discussion
If a cell contains a list value then assign formula X, Y, Z?
Hello,
I have a spreadsheet that is being used for insurance purposes. I have a column that has a list set up through Data Validation. I am trying to create a formula that will essentially do this ...
#1. If the cell contains List Value Auto, Home, etc. then ...
#2. assign formula X, Y, Z, etc. to a cell in this column which is calculating a percentage of #3
The formula in column #3 is a simple "=Fxx*0.09" but I need the percentage to be tied to a specific list value from #1. Not sure best route. Open to anything.
Thanks for the help!
5 Replies
- Martin_WeissBronze Contributor
Hi MyCrymbals82
you could create a reference table with the percentages per product. That table could be anywhere in your workbook. In my example, I just put it beside of your entry table, but that does not matter:
=I2*VLOOKUP(F2;$O$2:$P$6;2;FALSE)
So, depending on the product entered in cell F2, it looks for the matching percentage in the reference table and multiplies the premium with it.
- MyCrymbals82Copper Contributor
Thanks for your reply. I'm closer now but for some reason it doesn't like the Policy Type, cell E3 (Product in your example). No idea why because there is nothing on that field.
=F3*VLOOKUP(E3;$L$2:$P$6;2;FALSE)
- Martin_WeissBronze Contributor
Hi MyCrymbals82
what happens if you enter a policy type in E3. Do you still get an error?
If E3 is empty, there will be an error because the formula tries to find an empty value in the lookup table, which does not exist there.
To avoid this, you could also enhance the formula like this:
=F3*IFERROR(VLOOKUP(E3;$L$2:$P$6;2;FALSE);0)