ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   if statement in formula (https://www.excelbanter.com/excel-discussion-misc-queries/236220-if-statement-formula.html)

Derrick

if statement in formula
 
is it possible to do this:

D2 = A2 * if(B1= "1/4 points", A2/4, if(B2="1/8 points", A2/8)) * A3

a b c d
1 LENGTH POSITION HEIGHT ANSWER
2 12 "1/4 points" 24 864
3 12 "1/8 points" 24 432

with my if statement... to avoid writing my formula 3 times... this is a
hugely simplified formula - the actual one is several lines long, and i'd
like to minimize code.
thanks,

Bob Phillips[_3_]

if statement in formula
 
This works for me

= A2*IF(B2="1/4 points",A2/4,IF(B2="1/8 points",A2/8))*A2

although it is half the number that you show


--
__________________________________
HTH

Bob

"Derrick" wrote in message
...
is it possible to do this:

D2 = A2 * if(B1= "1/4 points", A2/4, if(B2="1/8 points", A2/8)) * A3

a b c d
1 LENGTH POSITION HEIGHT ANSWER
2 12 "1/4 points" 24 864
3 12 "1/8 points" 24 432

with my if statement... to avoid writing my formula 3 times... this is a
hugely simplified formula - the actual one is several lines long, and i'd
like to minimize code.
thanks,




Luke M

if statement in formula
 
While that is a valid formula, if you're dealing with multiple text values
which already contain the number you want, why not do this:

=C2*A2*A2/MID(B2,FIND("/",B2)+1,FIND(" ",B2)-FIND("/",B2)-1)

I'm assuming you wanted to multiply by height (C2) and not A3. Note that you
could now copy this down, and you don't have to worry about all the different
fractions you might have.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Derrick" wrote:

is it possible to do this:

D2 = A2 * if(B1= "1/4 points", A2/4, if(B2="1/8 points", A2/8)) * A3

a b c d
1 LENGTH POSITION HEIGHT ANSWER
2 12 "1/4 points" 24 864
3 12 "1/8 points" 24 432

with my if statement... to avoid writing my formula 3 times... this is a
hugely simplified formula - the actual one is several lines long, and i'd
like to minimize code.
thanks,


Derrick

if statement in formula
 
luke, thanks for the input - actually, these are text values are from a
validated list, so there's not going to be any variance.. so it will be
easier in the long run... i wont have to look for '1/2.455 points' or
anything like that

"Luke M" wrote:

While that is a valid formula, if you're dealing with multiple text values
which already contain the number you want, why not do this:

=C2*A2*A2/MID(B2,FIND("/",B2)+1,FIND(" ",B2)-FIND("/",B2)-1)

I'm assuming you wanted to multiply by height (C2) and not A3. Note that you
could now copy this down, and you don't have to worry about all the different
fractions you might have.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Derrick" wrote:

is it possible to do this:

D2 = A2 * if(B1= "1/4 points", A2/4, if(B2="1/8 points", A2/8)) * A3

a b c d
1 LENGTH POSITION HEIGHT ANSWER
2 12 "1/4 points" 24 864
3 12 "1/8 points" 24 432

with my if statement... to avoid writing my formula 3 times... this is a
hugely simplified formula - the actual one is several lines long, and i'd
like to minimize code.
thanks,


Derrick

if statement in formula
 
ok thanks!
whoops. i made a mistake in writing the formula.. lol the last *A2 should be
*C2... which would explain ur half of my answer.
for some reason i was getting an error when doing my formula, so now that i
know it works, i'll go through it and look.


"Bob Phillips" wrote:

This works for me

= A2*IF(B2="1/4 points",A2/4,IF(B2="1/8 points",A2/8))*A2

although it is half the number that you show


--
__________________________________
HTH

Bob

"Derrick" wrote in message
...
is it possible to do this:

D2 = A2 * if(B1= "1/4 points", A2/4, if(B2="1/8 points", A2/8)) * A3

a b c d
1 LENGTH POSITION HEIGHT ANSWER
2 12 "1/4 points" 24 864
3 12 "1/8 points" 24 432

with my if statement... to avoid writing my formula 3 times... this is a
hugely simplified formula - the actual one is several lines long, and i'd
like to minimize code.
thanks,





Luke M

if statement in formula
 
Ok, thanks for response. You basic formula structure is okay then, just need
to swap the A3 reference out to:

=A2*IF(B2="1/4 points",A2/4,IF(B2="1/8 points",A2/8))*C2
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Derrick" wrote:

luke, thanks for the input - actually, these are text values are from a
validated list, so there's not going to be any variance.. so it will be
easier in the long run... i wont have to look for '1/2.455 points' or
anything like that

"Luke M" wrote:

While that is a valid formula, if you're dealing with multiple text values
which already contain the number you want, why not do this:

=C2*A2*A2/MID(B2,FIND("/",B2)+1,FIND(" ",B2)-FIND("/",B2)-1)

I'm assuming you wanted to multiply by height (C2) and not A3. Note that you
could now copy this down, and you don't have to worry about all the different
fractions you might have.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Derrick" wrote:

is it possible to do this:

D2 = A2 * if(B1= "1/4 points", A2/4, if(B2="1/8 points", A2/8)) * A3

a b c d
1 LENGTH POSITION HEIGHT ANSWER
2 12 "1/4 points" 24 864
3 12 "1/8 points" 24 432

with my if statement... to avoid writing my formula 3 times... this is a
hugely simplified formula - the actual one is several lines long, and i'd
like to minimize code.
thanks,


Jacob Skaria

if statement in formula
 
TRY

=A2^2/(IF(B2="1/4 points",4,IF(B2="1/8 points",8)))*C2

If this post helps click Yes
---------------
Jacob Skaria


"Derrick" wrote:

is it possible to do this:

D2 = A2 * if(B1= "1/4 points", A2/4, if(B2="1/8 points", A2/8)) * A3

a b c d
1 LENGTH POSITION HEIGHT ANSWER
2 12 "1/4 points" 24 864
3 12 "1/8 points" 24 432

with my if statement... to avoid writing my formula 3 times... this is a
hugely simplified formula - the actual one is several lines long, and i'd
like to minimize code.
thanks,


Derrick

if statement in formula
 
Jacob-
thanks, and that would work, but the goal was to know if having an if
statment would work - the formula below was a simplified example of one im
working on. so, albeit shorter, quite unneccessary lol.

Thanks

"Jacob Skaria" wrote:

TRY

=A2^2/(IF(B2="1/4 points",4,IF(B2="1/8 points",8)))*C2

If this post helps click Yes
---------------
Jacob Skaria


"Derrick" wrote:

is it possible to do this:

D2 = A2 * if(B1= "1/4 points", A2/4, if(B2="1/8 points", A2/8)) * A3

a b c d
1 LENGTH POSITION HEIGHT ANSWER
2 12 "1/4 points" 24 864
3 12 "1/8 points" 24 432

with my if statement... to avoid writing my formula 3 times... this is a
hugely simplified formula - the actual one is several lines long, and i'd
like to minimize code.
thanks,



All times are GMT +1. The time now is 11:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com