Results 1 to 6 of 6
  1. #1
    3 Star Lounger
    Join Date
    Dec 2009
    Posts
    212
    Thanks
    36
    Thanked 0 Times in 0 Posts

    if,and added to nested ifs

    Condition 1 If B = "clinic", then D = C*8
    Condition 2 If B = "clinic", and E = 1, then D = (C*8)+4
    Condition 3 If B = "work", then D = C*20
    Condition 4 If B = "showup", then D =20

    I got for conditions 1,3,4:
    =IF(B30="clinic",C30*8,IF(B30="work",C30*20,IF(B30 ="showup",20)))
    I got for condition 2:
    =IF(AND(B28="clinic",E28=1),(C28*8)+4,C28*8)

    How do I incorporate both/all together?

  2. #2
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,434
    Thanks
    371
    Thanked 1,457 Times in 1,326 Posts
    Skipro,

    This should do it if I got the parens counted right.


    =if(B30="work",B30=C30*2,If(B30="showup",20,If(B30 ="clinic",If(E30=1,D30=C30*8+4,C30*8),"Error")) )
    Last edited by RetiredGeek; 2011-12-26 at 20:58.
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  3. #3
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts
    Alternatively:
    =IF(B30="work",C30*2,IF(B30="showup",20,IF(B30 ="clinic",C30*8+(E30=1)*4,"Error")))
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  4. #4
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts
    Quote Originally Posted by RetiredGeek View Post
    Skipro,

    This should do it if I got the parens counted right.


    =if(B30="work",B30=C30*2,If(B30="showup",20,If(B30 ="clinic",If(E30=1,D30=C30*8+4,C30*8),"Error")) )
    Hi retiregeek,

    That won't work. At the minimum, you need to reduce the formula to:
    =if(B30="work",C30*2,If(B30="showup",20,If(B30="cl inic",If(E30=1,D30=C30*8+4,C30*8),"Error")))
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  5. #5
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,434
    Thanks
    371
    Thanked 1,457 Times in 1,326 Posts
    Paul,

    Thanks, obviously you think clearer than I in the late/early hours.
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  6. #6
    3 Star Lounger
    Join Date
    Dec 2009
    Posts
    212
    Thanks
    36
    Thanked 0 Times in 0 Posts
    Thank you RG and MP.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •