+ Reply to Thread
Results 1 to 11 of 11

getting days of the week ( mon, tu, wed,,,) to change based on time in preceeding row.

  1. #1
    Registered User
    Join Date
    09-16-2012
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    7

    getting days of the week ( mon, tu, wed,,,) to change based on time in preceeding row.

    i have a worksheet where i track batches start and end times based on the amount of time each takes

    ex
    batch # start end
    580 0:00 12:30 [B]MON[B]
    581 12:30 01:00 How can it get this area to show TU based on the time change to a new day?

  2. #2
    Forum Expert Kevin UK's Avatar
    Join Date
    12-07-2010
    Location
    Radstock, Somerset
    MS-Off Ver
    365
    Posts
    1,922

    Re: getting days of the week ( mon, tu, wed,,,) to change based on time in preceeding row.

    Hi randomhavok

    Would it not be easier if you included the date!

  3. #3
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: getting days of the week ( mon, tu, wed,,,) to change based on time in preceeding row.

    In the example given the date HASN'T changed.
    0:00 12:30 is Mon
    12:30 1:00 is still Mon since the greatest time in a day is 23:59:59, 00:00:00 would be the next day.

    You could try something along the lines of
    IF(B2<A2, "newday","sameday")

    where B1 and A1 are times as youve suggested
    Then you just gotta work out how to add 1 to the existing day.

    I agree with Kevin UK, adding a date would make life simpler
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: getting days of the week ( mon, tu, wed,,,) to change based on time in preceeding row.

    If times are in B2 and C2 perhaps you could use this formula in D2 (assuming previous weekday like "Mon" in D1)

    =TEXT(INDEX({1,2,3,4,5,6,7},MATCH(D1,TEXT({1,2,3,4,5,6,7},"ddd"),0)+(C2<B2)),"ddd")
    Audere est facere

  5. #5
    Registered User
    Join Date
    09-16-2012
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: getting days of the week ( mon, tu, wed,,,) to change based on time in preceeding row.

    it works to change to Tue, Wed etc but sometimes the batches run into the same day how can i get where it will keep Mon if less then 23:59?

  6. #6
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: getting days of the week ( mon, tu, wed,,,) to change based on time in preceeding row.

    The idea is that D2 will keep the same day as D1 as long as B2 < C2 so if B2 = 17:00 and C2 = 23:00 then the day will stay the same......but if B2 = 21:00 and C2 = 06:00 then D2 will be a day after D1, isn't that what you wanted?

    If not then please post a sample workbook with some representative sample data and an indication of the required results

  7. #7
    Registered User
    Join Date
    09-16-2012
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: getting days of the week ( mon, tu, wed,,,) to change based on time in preceeding row.

    i have included a sample and manually entered the days for the desired results
    usually with go with m, t, w, th but if excel will not accept i can change to mon, tue etc.

    You have been a great help
    thank you
    Attached Files Attached Files

  8. #8
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: getting days of the week ( mon, tu, wed,,,) to change based on time in preceeding row.

    Are we talking 7 days a week, e.g. including sa and su or do you want f to go straight to m?

  9. #9
    Registered User
    Join Date
    09-16-2012
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: getting days of the week ( mon, tu, wed,,,) to change based on time in preceeding row.

    95% of the time it is monday to friday.
    worst case i can manually add the saturday when necessary

    thanks

  10. #10
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: getting days of the week ( mon, tu, wed,,,) to change based on time in preceeding row.

    OK, assuming the first day is entered manually in E1 and is either m, t, w, th or f then try this formula in E2 copied down

    =INDEX({"m","t","w","th","f","m","t"},MATCH(E1,{"m","t","w","th","f"},0)+(MOD(B2,1)<MOD(C1,1))+(MOD(C2,1)<MOD(B2,1)))

  11. #11
    Forum Expert Kevin UK's Avatar
    Join Date
    12-07-2010
    Location
    Radstock, Somerset
    MS-Off Ver
    365
    Posts
    1,922

    Re: getting days of the week ( mon, tu, wed,,,) to change based on time in preceeding row.

    Get a bit complicated now, just to show the day of the week!

+ 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