+ Reply to Thread
Results 1 to 3 of 3

Confusing Excel MOD Function Results

  1. #1
    Registered User
    Join Date
    02-23-2012
    Location
    Brisbane, CA
    MS-Off Ver
    Excel 2007
    Posts
    1

    Confusing Excel MOD Function Results

    I’m using the mod function as follows:

    Mod(Date 1 – Date 2, 365), where date 1 is a fixed date in time (say 9/1/2010) and date 2 is last day of each month in the future (e.g., 8/31/16).

    You’d think that the MOD function would give the exact same result for each month end date, right? Not so:


    • =MOD(9/1/10-8/31/10,365)=1
    • =MOD(9/1/10-8/31/11,365)=1
    • =MOD(9/1/10-8/31/12,365)=0
    • =MOD(9/1/10-8/31/13,365)=0
    • =MOD(9/1/10-8/31/14,365)=0
    • =MOD(9/1/10-8/31/15,365)=0
    =MOD(9/1/10-8/31/16,365)=364

    Thoughts?

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

    Re: Confusing Excel MOD Function Results

    THose are not being read like dates.
    =MOD(9/1/10-8/31/10,365)=1

    That's being read like
    9 divided by 1 divided by 10 minus 8 divided by 31 divided by 10

    Try
    =MOD(DATE(2010,9,1)-DATE(2010,8,31),365)=1

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

    Re: Confusing Excel MOD Function Results

    I expect it has to do with leap years. A year is not exactly 365 days. So we have leap years (366 days) to account for the difference. Looking at your examples, the mod function output changes with each leap year (2012 and 2016), and, at first glance, the change in the output seems consistent with those years being longer than 365 days.

    With that in mind, what exactly are you trying to get from your mod function? Are you familiar with how Excel stores dates and times as serial numbers (http://www.cpearson.com/Excel/datetime.htm#SerialDates )?
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Confusing nested function (IF, LOOKUP, CHOOSE, MATCH)
    By John_126 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 06-30-2016, 03:46 PM
  2. how to extract data from data sheet to fill a table ??
    By eslamturki in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-17-2015, 06:40 AM
  3. Date format confusing Excel
    By Atlanticja in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-03-2012, 08:36 AM
  4. Replies: 1
    Last Post: 03-21-2012, 11:22 AM
  5. Excel confusing '1' and '10'
    By Barking_Mad in forum Excel General
    Replies: 3
    Last Post: 10-14-2010, 06:29 AM
  6. excel code tweak for outlook - confusing
    By periro16 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-18-2005, 06:05 AM
  7. [SOLVED] Confusing Invisible Excel Sheet
    By Jack in forum Excel General
    Replies: 2
    Last Post: 03-03-2005, 05:06 PM

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