How do I return a formula using lookup

  • Thread starter Thread starter daveyboy
  • Start date Start date
D

daveyboy

I have a spreadsheet that uses 3 different formulas. I am trying to ge
a cell to use a certain formula based on a condition. For example
Depending on whether my weight is <100, I want the spreadsheet to us
one of the three formulas to calculate my exercise time.

if my weight <100 I want the cell to use formula #1
If my weight is >100 I want the cell to use formula #2
If my weihgt is >150 I want to use formula #3

I would like to store the formulas in a table. Is that the best way t
do this
 
One (brutish) way is to use CHOOSE.

The setup is =CHOOSE(number,option 1, option 2, option 3, etc.)

So you could use something like

=CHOOSE(IF(B1<100,1,IF(B1>100,2,IF(B1>150,3,""))),formula1,formula2,formula3
)
 
I have a spreadsheet that uses 3 different formulas. I am trying to get
a cell to use a certain formula based on a condition. For example,
Depending on whether my weight is <100, I want the spreadsheet to use
one of the three formulas to calculate my exercise time.

if my weight <100 I want the cell to use formula #1
If my weight is >100 I want the cell to use formula #2
If my weihgt is >150 I want to use formula #3

I would like to store the formulas in a table. Is that the best way to
do this?

What do you do if your weight exactly equals 100? Asuming you mean wt < 100, 100
<= wt < 150, 150 < wt, you could use a lookup.

=LOOKUP(wt,{0,100,150},{1,0,0}*formula1+{0,1,0}*formula2+{0,0,1}*formula3)

But the more direct approach may be better.

=IF(wt<100,formula1,IF(wt<150,formula2,formula3))
 
Harlan Grove said:
...

What do you do if your weight exactly equals 100? Asuming you mean wt < 100, 100
<= wt < 150, 150 < wt, you could use a lookup.

I think our poster is using a little poetic license there with those
weights, bless his soul.

If they're kilos, well, that's something else.
 
Back
Top