+ Reply to Thread
Results 1 to 7 of 7

SUM on MOD

  1. #1
    Registered User
    Join Date
    10-15-2018
    Location
    London, England
    MS-Off Ver
    365
    Posts
    75

    SUM on MOD

    Help Please......

    I have 10 assets that I plan maintenance for. Each planned maintenance exam has a +/- 2 day tolerance. Each asset runs in order from 1 to 10 then over again (every 10 days).

    I need a column that will calculate how many days above or below its actual completion date was compared to its planned completion date.

    I assume it will be a combination of IF, SUM and MOD, but have spent a while trying to figure something out without much success yet.

    Attached is an example spreadsheet with a column providing the expected result.
    Attached Files Attached Files
    Last edited by 77highland; 02-11-2020 at 09:34 AM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: SUM on MOD

    I cannot understand how you are getting some of these results. Please see the red numbers and explain how you got them.
    Data Range
    Date
    Planned
    Actual
    Expected Result
    1-Jan-20
    1
    1
    0
    2-Jan-20
    2
    2
    0
    3-Jan-20
    3
    3
    0
    4-Jan-20
    4
    5
    +1
    5-Jan-20
    5
    6
    +2
    6-Jan-20
    6
    7
    +3
    7-Jan-20
    7
    5
    -2
    8-Jan-20
    8
    7
    -1
    9-Jan-20
    9
    1
    +2
    10-Jan-20
    10
    3
    +3
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    10-15-2018
    Location
    London, England
    MS-Off Ver
    365
    Posts
    75

    Re: SUM on MOD

    @6StringJazzer........... sorry I had a couple of the 'expected results' incorrect. I have replaced the example spreadsheet with a new version, which also includes a brief description of each expected result

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: SUM on MOD

    In your new sample, explain the last two rows.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  5. #5
    Registered User
    Join Date
    10-15-2018
    Location
    London, England
    MS-Off Ver
    365
    Posts
    75

    Re: SUM on MOD

    The sequence is 1,2,3,4,5,6,7,8,9,10,1,2,3,4,5......... and so on. Assets 1 to 10 run through their maintenance in sequence so 1 is always planned after 10.

    But if 'asset 10' is the planned unit but we complete 'asset 2' then we are +2 days ahead
    Whereas if 'asset 10' is the planned unit but we complete 'asset 8' then we are -2 days behind

    I hope this helps, any help is greatly appreciated

  6. #6
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,825

    Re: SUM on MOD

    Here's how I see it:

    Most of the results can be calculated as =D7-C7
    The row 15 and 16 results can be calculated as =MOD(D16-C16,10). This formula also works for many of the others, but fails for others.
    The real question I see is how to decide when to apply the MOD() function and when not to. Once we know that, we can use an IF() function -- =IF(condition,MOD(D7-C7,10),D7-C7)

    How do you choose? How did you decide that row 13 (planned 7 actual 5) was 2 days before and not 8 days after? How did you decide that row 16 (planned 10 actual 3) is 3 days after and not 7 days before?
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  7. #7
    Registered User
    Join Date
    10-15-2018
    Location
    London, England
    MS-Off Ver
    365
    Posts
    75

    Re: SUM on MOD

    @MrShorty...... that's perfect.

    I manipulated slightly to give myself the desired result =IF(C7-D7)>5,"+"&(MOD(D7-C7,10),"-"&D7-C7)

    Thank you very much.......... Case Solved

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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