简体   繁体   中英

How can I conditionally choose a math formula to calculate a value in Excel?

I am trying to produce an interactive Excel-based calculator to produce time estimates based on a selected Activity type and an input Quantity. Each activity type has its own formula to convert the input quantity into its respective time estimate. The formulas used are based on the activity type and are either linear equations ( mx+b ) or scalars (e,g, .2, 4, etc) to be performed on the input quantity.

The way I have approached it has brought me to a dead-end. Below is an image of my attempt. Yellow columns are input, Blue columns are returned values.

Column A uses a drop-down menu for the user to select the Activity type. {Reading, Writing, Quiz, Term Paper} Column B uses VLOOKUP to return the appropriate unit. {words, questions}

Column C prompts for a Quantity of that unit. Column D uses Column A and a VLOOKUP again to identify the appropriate formula to calculate the estimate, given the input quantity.

Works fine in simple cases of scalars eg =C1*VLOOKUP(A3, ARRAY, 3, FALSE) , but the linear equation has me stuck. I would need to multiply the input value and then subtract from that product. In other words, I need to plug in the input value into a VLOOKUP-derived formula.

enter image description here

Change your set up to have m in one column and b in another:

在此处输入图像描述

then you can use one formula:

=C2*VLOOKUP(A2,F:I,3,FALSE)+VLOOKUP(A2,F:I,4,FALSE)

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM