+ Reply to Thread
Results 1 to 7 of 7

Can I combine 3 IF statements into one?

  1. #1
    Registered User
    Join Date
    03-11-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    14

    Can I combine 3 IF statements into one?

    Background here is these are hotel cleaners, that can either clean rooms, or clean public areas, or do both on the same day.

    F2 is the rate that they are paid for the type of work, E2 is the public areas they've cleaned, and G2 is the rooms they've cleaned. I need to find a way that I can work out their overall wage based on the work they have done.

    =IF(E2<>0,(IF(G2=0,(E2*F2),0)),0)
    =IF(G2<>0,(IF(E2=0,(G2*F2),0)),0)
    =IF(G2<>0,(IF(E2<>0,((G2*F2)+(E2*F2)),0)),0)

    I've written the 3 IF statements above to come up with a figure for if they have done one type only, or both. I'm pretty sure they're very cumbersome though. Is there a better function I could use, or a way to combine these 3 statements into one?

    Thanks in advance!

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Can I combine 3 IF statements into one?

    Let's go about it this way.

    You have 4 possible combinations of E2 and G2, please fill in the ??

    E2 = 0 And G2 = 0 I Want ??
    E2 = 0 And G2 < > 0 I Want ??
    E2 < > 0 And G2 = 0 I Want ??
    E2 < > 0 And G2 < > 0 I Want ??

  3. #3
    Registered User
    Join Date
    03-11-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Can I combine 3 IF statements into one?

    E2 = 0 And G2 = 0 I Want 0
    E2 = 0 And G2 < > 0 I Want G2*F2
    E2 < > 0 And G2 = 0 I Want E2*F2
    E2 < > 0 And G2 < > 0 I Want (E2*F2)+(G2*F2)

  4. #4
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Can I combine 3 IF statements into one?

    How about

    =E2*F2+G2*F2

  5. #5
    Registered User
    Join Date
    03-11-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Can I combine 3 IF statements into one?

    Well that was far easier than I was making it.

    Thanks

  6. #6
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Can I combine 3 IF statements into one?

    Quote Originally Posted by Mike7591 View Post
    Well that was far easier than I was making it.

    Thanks
    Glad to help, and no worries...That happens ALOT.

  7. #7
    DaveDeV
    Guest

    Re: Can I combine 3 IF statements into one?

    Hi Mike,

    I see J1 has solved the problem as stated.
    There is another approach to using compound IF statements in situations like this and that is to use LOOKUP tables in place of IFs.

    The attached workbook shows how this approach can be used in three scenario options (linear calculations, hidden rates and hidden extensions) based on splitting vs combining formulae and using LOOKUP to retrieve rates (in case rate/room <> rate/area).

    HotelCleaningWageCalc-DdV.xlsx

    Just another approach...

    Dave

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1