TRC is primarily funded by ad revenue. If you like the content you find here, please do not block our ads. Thank you.
Results 1 to 10 of 10

Thread: Nested IF statements - Excel

  1. #1
    Should Get Out More Wreckless Rat's Avatar
    Join Date
    Jan 2008
    Location
    Norfolkshire
    Posts
    18,056
    Like
    175
    Liked 160 in 90 posts
    Blog Entries
    1

    Default Nested IF statements - Excel

    Another excel question. Sorry.

    I have a sheet I am working on for hedgehog drug treatments and want to add an IF statement to apply before another if statement but I cant seem to get it working. Help

    Example. Cell F5 checks to see if there is a weight in cell D5 if so, apply the weight/dose formula. But.... I also want it to check cell F2 to see if it contains a YES before doing the calculation or if the cell contains NO do nothing.

    Doe that make sense? I hope so.

    So in F5 I currently have

    =IF(D5="","",D5*0.0008 ) ignore the space I had to add it on here cos of emotes


  2. TRC is primarily funded by ad revenue. If you like the content you find here, please do not block our ads. Thank you.
  3. #2
    Really Bored burty's Avatar
    Join Date
    Jan 2009
    Location
    Medway Taahns Innit
    Posts
    2,633
    Like
    1
    Liked 4 in 4 posts
    Blog Entries
    1

    Default Re: Nested IF statements - Excel

    Your logical test needs to include an AND so it becomes:

    =IF(AND(F6="yes",D5="" ),"",D5*0.0008 )
    Register to join this UK Motorbike Forum, start a motorbike blog, or use our free motorbike classifieds!

  4. #3
    Should Get Out More Wreckless Rat's Avatar
    Join Date
    Jan 2008
    Location
    Norfolkshire
    Posts
    18,056
    Like
    175
    Liked 160 in 90 posts
    Blog Entries
    1

    Default Re: Nested IF statements - Excel

    Quote Originally Posted by burty View Post
    Your logical test needs to include an AND so it becomes:

    =IF(AND(F6="yes",D5="" ),"",D5*0.0008 )
    That doesn't work either.

  5. #4
    Should Get Out More
    Join Date
    Dec 2007
    Posts
    9,799
    Like
    18
    Liked 48 in 29 posts

    Default Re: Nested IF statements - Excel

    Quote Originally Posted by Wreckless Rat View Post
    That doesn't work either.
    Even if you change it to =IF(AND($F$2="yes",D5="" ),"",D5*0.0008 ) ?

  6. #5
    Should Get Out More Wreckless Rat's Avatar
    Join Date
    Jan 2008
    Location
    Norfolkshire
    Posts
    18,056
    Like
    175
    Liked 160 in 90 posts
    Blog Entries
    1

    Default Re: Nested IF statements - Excel


  7. #6
    At Work Lob's Avatar
    Join Date
    Feb 2008
    Location
    Switzerland
    Posts
    1,937
    Like
    12
    Liked 15 in 11 posts

    Default Re: Nested IF statements - Excel

    =if(f2="yes",if(d5="","",$d$5*0.0008),"")

    You might have to make some additions to force the case into upper text for the check etc but this will do it conditionally on Yes/No

  8. #7
    Really Bored burty's Avatar
    Join Date
    Jan 2009
    Location
    Medway Taahns Innit
    Posts
    2,633
    Like
    1
    Liked 4 in 4 posts
    Blog Entries
    1

    Default Re: Nested IF statements - Excel

    Put this into F5 and copy to the other cells:

    =IF(AND(F$2="YES",NOT(D5="")),D5*0.0008,"")

    Sorry, too slow
    Register to join this UK Motorbike Forum, start a motorbike blog, or use our free motorbike classifieds!

  9. #8
    Should Get Out More Wreckless Rat's Avatar
    Join Date
    Jan 2008
    Location
    Norfolkshire
    Posts
    18,056
    Like
    175
    Liked 160 in 90 posts
    Blog Entries
    1

    Default Re: Nested IF statements - Excel

    Quote Originally Posted by Lob View Post
    =if(f2="yes",if(d5="","",$d$5*0.000,"")

    You might have to make some additions to force the case into upper text for the check etc but this will do it conditionally on Yes/No
    Now this works, but it kills my conditional format....

    Hmm... a step in the right direction. Thanks

    thanks for the other input too folks, much appreciated. Now I just need to work out why I can't conditionally format the cell with that formula in. hmmm

  10. #9
    At Work Lob's Avatar
    Join Date
    Feb 2008
    Location
    Switzerland
    Posts
    1,937
    Like
    12
    Liked 15 in 11 posts

    Default Re: Nested IF statements - Excel

    your conditional format is for a blank cell. it's no longer blank when it has a value in.

    hth.

  11. #10
    Should Get Out More Wreckless Rat's Avatar
    Join Date
    Jan 2008
    Location
    Norfolkshire
    Posts
    18,056
    Like
    175
    Liked 160 in 90 posts
    Blog Entries
    1

    Default Re: Nested IF statements - Excel

    Couldn't seem to get the conditional formatting to work any more, so I gave up.

    The final version seems to work though, so thanks folks.

    http://hogspital.co.uk/docs/Drug-chart-template%20.xlsx

    This makes it much easier for Miss Wrat and I to work out the jabs.

Go Back to Forum My Forum