+ Reply to Thread
Results 1 to 8 of 8

How to consolidate, or compress this equation.

  1. #1
    Registered User
    Join Date
    06-11-2012
    Location
    Illinois, United States
    MS-Off Ver
    Excel 2010
    Posts
    4

    Question How to consolidate, or compress this equation.

    Hi forum,
    I have been working on this time schedule spreadsheet and formula for my current work place. It works but it is very very long, can any one help me to shorten the (=IF) formula, thank you!

    *edit I have added the workbook to the thread.

    =IF(C3="9 to 7",10,IF(C3="9 to 5",8,IF(C3="9 to 6",9,IF(C3="9 to 1",4,IF(C3="11 to 7",8,IF(C3="Off",0,IF(C3="12 to 5",5,)))))))+IF(D3="9 to 7",10,IF(D3="9 to 5",8,IF(D3="9 to 6",9,IF(D3="9 to 1",4,IF(D3="11 to 7",8,IF(D3="Off",0,IF(D3="12-5",5,)))))))+IF(E3="9 to 7",10,IF(E3="9 to 5",8,IF(E3="9 to 6",9,IF(E3="9 to 1",4,IF(E3="11 to 7",8,IF(E3="Off",0,IF(E3="12 to 5",5,)))))))+IF(F3="9 to 7",10,IF(F3="9 to 5",8,IF(F3="9 to 6",9,IF(F3="9 to 1",4,IF(F3="11 to 7",8,IF(F3="Off",0,IF(F3="12 to 5",5,)))))))+IF(G3="9 to 7",10,IF(G3="9 to 5",8,IF(G3="9 to 6",9,IF(G3="9 to 1",4,IF(G3="11 to 7",8,IF(G3="Off",0,IF(G3="12 to 5",5,)))))))+IF(H3="9 to 7",10,IF(H3="9 to 5",8,IF(H3="9 to 6",9,IF(H3="9 to 1",4,IF(H3="11 to 7",8,IF(H3="Off",0,IF(H3="12 to 5",5,)))))))
    Attached Files Attached Files
    Last edited by GTFORCEMTB; 06-11-2012 at 07:20 PM.

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: How to consolidate, or compress this equation.

    FTGORCEMTB,

    Using your posted formula, this should work:
    Please Login or Register  to view this content.

    Note that if you have a start and end time in the same half of the day (as in, if both were AM or if both were PM, like "3 to 11" or "1 to 9") this formula wouldn't return a correct result.
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: How to consolidate, or compress this equation.

    Hi,

    One way would be to create a table of

    Please Login or Register  to view this content.
    and then use =VLOOKUP(C3,tableabove,2,False)+VLOOKUP(D3,tableabove,2,False)+....etc
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Registered User
    Join Date
    06-11-2012
    Location
    Illinois, United States
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: How to consolidate, or compress this equation.

    I have included the workbook to the thread now if that will help. Thanks.

  5. #5
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: How to consolidate, or compress this equation.

    GTFORCEMTB,

    Attached is a modified version of your posted workbook. On sheet 'Schedule' cell I3 and copied down is this formula:
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    06-11-2012
    Location
    Illinois, United States
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: How to consolidate, or compress this equation.

    Thanks tigeravatar that works perfect. I appreciate everyone's time.

    Quote Originally Posted by tigeravatar View Post
    GTFORCEMTB,

    Attached is a modified version of your posted workbook. On sheet 'Schedule' cell I3 and copied down is this formula:
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    06-11-2012
    Location
    Illinois, United States
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: How to consolidate, or compress this equation.

    I do have one question how ever say i want to add new shifts how would i go about doing that?

  8. #8
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: How to consolidate, or compress this equation.

    GTFORCEMTB,

    Currently the formula will calculate any shift you type in, although it will have the previously mentioned constraint:
    Quote Originally Posted by tigeravatar View Post
    Note that if you have a start and end time in the same half of the day (as in, if both were AM or if both were PM, like "3 to 11" or "1 to 9") this formula wouldn't return a correct result.
    So if your new shifts will start and end in the same half of the day, either the formula would need to be adjusted, or a different approach used (like the vlookup approach suggested by Richard)

+ 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