Multiple IF Statements

  • I'm trying to determine a load, but it seems that the cell needs multiple if statements and I cant seem to get it to work quite right.


    if sec = 1, if sec*lab+sec*lec>1.5*sec then 1.5*sec, else sec*lab+sec*lec
    but if sec=2, if sec*lab+sec*lec>3*sec then 3*sec, else sec*lab+sec*lec
    but if sec=3, if sec*lab+sec*lec>4.5*sec then 4.5*sec, else sec*lab+sec*lec


    I need to do this on an excel side, not VBA but when I plug it in, I either get a True/false returned or #VALUE

    I don't know if I need to use a if/or or if/and?? I would super appreciate anyone willing to take the time to help me on this one! Thanks :)

  • Re: Multiple IF Statements


    As you haven't explained what 'sec', 'lab' & 'lec' are, I'll assume named ranges.


    You might find it easier to use the Choose() function for the first selection (sec=1, 2 or3), it makes it a lot clearer when viewing the formula.



    =CHOOSE(sec, IF((sec *lab)+(sec*lab)>sec*1.5, sec*1.5, sec*2), 2, 3)



    Because of my assumption, that only includes the calculation for sec = 1. You should be able to replace the last 2 parameters (2 & 3) with the relevant calculation, and why not use (sec *lab) * 2 rather than (sec *lab)+(sec*lab)?


    OK, I've edited this 3 times and it refuses to add the new lines - hopefully double spacing them might work but if this is still all running together I have tried to edit it.

  • Re: Multiple IF Statements


    Try this


    =IF(sec=1,IF(sec*lab+sec*lec>1.5*sec,1.5*sec,sec*lab+sec*lec),IF(sec=2,IF(sec*lab+sec*lec>3*sec,3*sec,sec*lab+sec*lec),IF(sec=3,IF(sec*lab+sec*lec>4.5*sec,4.5*sec,sec*lab+sec*lec),"")))


    or, using Choose


    =IFERROR(CHOOSE(sec, IF(sec *lab+sec*lec>sec*1.5, sec*1.5, sec *lab+sec*lec), IF(sec *lab+sec*lec>sec*3, sec*3, sec *lab+sec*lec),IF(sec *lab+sec*lec>sec*4.5, sec*4.5, sec *lab+sec*lec)),"")


    Both of these will return an empty cell value if sec is anything other than 1, 2 or 3

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!