+ Reply to Thread
Results 1 to 5 of 5

Calculate the gap between two days.

  1. #1
    Forum Contributor
    Join Date
    03-08-2011
    Location
    Lubbock, TX, USA
    MS-Off Ver
    MS OFFICE 365 EXCEL, OUTLOOK, WORD, POWERPOINT
    Posts
    196

    Calculate the gap between two days.

    I'm looking for a simple way to calculate between two days. I thought it'd be simple. But, apparently days are not dates
    The Gap between pulling parts and the tech pickup of his parts will be used to progressively add to the number of parts issued. THAT was actually easy to do. I feel like the answer is far more simple than I am seeing. If it help, Monday is always day one and Sunday is always day seven. I did a really gnarly nested if formula. I'd rather not copy that formula down 1000 rows of data if I can avoid it.

    Capture.PNG

    Any help appreciated. Thanks.

  2. #2
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Calculate the gap between two days.

    Maybe this
    Enter formula in D2 and copy down
    Lookup table in F2:G8
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    v A B C D E F G
    1 PULL DAY DELIVERY PICKUP GAP Lookup Table
    2 MONDAY TUESDAY WEDNESDAY 2 MONDAY 1
    3 TUESDAY WEDNESDAY THURSDAY 2 TUESDAY 2
    4 WEDNESDAY THURSDAY THURSDAY 1 WEDNESDAY 3
    5 THURSDAY FRIDAY SUNDAY 3 THURSDAY 4
    6 FRIDAY 5
    7 SATURDAY 6
    8 SUNDAY 7
    9
    Last edited by AlKey; 03-09-2018 at 11:52 PM.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  3. #3
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2024
    Posts
    6,181

    Re: Calculate the gap between two days.

    Or try:

    =IFERROR(MOD(MATCH(C2,$F$2:$F$8,0)-MATCH(A2,$F$2:$F$8,0)-1,7)+1,"")

  4. #4
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Calculate the gap between two days.

    If you don't want to use cells, you could just define a name to contain the list. (Click Name Manager on the Formula tab.)
    DayNm = {"Monday";"Tuesday";"Wednesday";"Thursday";"Friday";"Saturday";"Sunday"}
    Please Login or Register  to view this content.
    NOTE: Since you're applying MOD to a difference, there's no need to re-align numbering to 0-6
    Last edited by leelnich; 03-10-2018 at 07:54 AM.
    Clicking the Add Reputation star below helpful posts is a great way to show your appreciation.
    Please mark your threads as SOLVED upon conclusion (Thread Tools above Post # 1). - Lee

  5. #5
    Forum Contributor
    Join Date
    03-08-2011
    Location
    Lubbock, TX, USA
    MS-Off Ver
    MS OFFICE 365 EXCEL, OUTLOOK, WORD, POWERPOINT
    Posts
    196

    Re: Calculate the gap between two days.

    Quote Originally Posted by AlKey View Post
    Maybe this
    Enter formula in D2 and copy down [snip] ...
    Quote Originally Posted by Phuocam View Post
    Or try: =IFERROR(MOD(MATCH(C2,$F$2:$F$8,0)-MATCH(A2,$F$2:$F$8,0)-1,7)+1,"")
    Quote Originally Posted by leelnich View Post
    If you don't want to use cells, you could just define a name to contain the list....[snip]
    I want to thank each of you for your help. I was sitting there knowing that there was a way to do it and it would not come to me. That is funny because I do lookups all the time and it didn't even occur to me. I was intrigued by the MOD formula because I have never used it before. But, I went with the combo of the MOD and Name. I did that because I have never used MOD before and have only used the name manager a couple of times. So, that gave me the chance to actually learn and understand the formula and the manager for future use. Thanks again.

+ 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. [SOLVED] Calculate Yes or No if date is greater than 90 days and less than 365 days
    By Tashia in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-02-2017, 03:53 PM
  2. [SOLVED] Calculate Uptime in Days within the constraint of Total Days in Each Month
    By jchungerford in forum Excel Formulas & Functions
    Replies: 17
    Last Post: 04-29-2017, 06:54 PM
  3. [SOLVED] calculate total number of days between two days based on 365 days year
    By aparunkumar in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 03-14-2016, 12:51 AM
  4. Replies: 0
    Last Post: 06-11-2015, 03:12 AM
  5. [SOLVED] Calculate the number days between two user input days.
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-21-2013, 10:44 PM
  6. Calculate total working days and excepted leave days
    By megaiooo in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-21-2013, 09:29 AM
  7. Calculate vacation days taken or partial days
    By chris1965 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-20-2013, 07:18 PM

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