+ Reply to Thread
Results 1 to 10 of 10

IF function formula to specify time based on day of the week

  1. #1
    Registered User
    Join Date
    05-24-2022
    Location
    Mansfield, England
    MS-Off Ver
    Office 2021
    Posts
    20

    IF function formula to specify time based on day of the week

    I have a list of the days of the and a departure(or not)

    I need a formula (without requirement for lists) that specifies the correct departure time based upon the day of the week.

    Therefore, as per attached example, as cell E1 is showing 'Wed' then the time of 07:30 should be displayed in E3.

    Can a formula be created using E1 as the info cell with a IF function calculation in E3 with all the required options, i.e. days of week/times within the formula?
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    91,069

    Re: IF function formula to specify time based on day of the week

    If it's as your example, then this will do it:

    =INDEX($B$1:$B$7,MATCH($E$1,$A$1:$A$7,0))

    Format the result cell as time.
    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. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    05-24-2022
    Location
    Mansfield, England
    MS-Off Ver
    Office 2021
    Posts
    20

    Re: IF function formula to specify time based on day of the week

    Thank you for your prompt response.

    This works perfectly, however, the list in column A had been formatted to the Date format of ddd from this weeks date range.

    This then causes a problem when I get into next week as the result of the calculation returns N/A

    Is there any way that a formula will work if the cells A1:A7 are in text format and not date format?
    Last edited by rylan.browne; 08-17-2022 at 07:48 AM.

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: IF function formula to specify time based on day of the week

    Post a sample sheet showing EXACTLY what you mean.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  5. #5
    Registered User
    Join Date
    05-24-2022
    Location
    Mansfield, England
    MS-Off Ver
    Office 2021
    Posts
    20

    Re: IF function formula to specify time based on day of the week

    I have attached the file

    Thanks
    Attached Files Attached Files

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: IF function formula to specify time based on day of the week

    Thanks. Clear now.

    =INDEX($B$1:$B$7,MATCH(TEXT($E$1,"ddd"),$A$1:$A$7,0))

  7. #7
    Registered User
    Join Date
    05-24-2022
    Location
    Mansfield, England
    MS-Off Ver
    Office 2021
    Posts
    20

    Re: IF function formula to specify time based on day of the week

    Thank you, it works perfectly.

  8. #8
    Registered User
    Join Date
    05-24-2022
    Location
    Mansfield, England
    MS-Off Ver
    Office 2021
    Posts
    20

    Re: IF function formula to specify time based on day of the week

    Hi, just one last thing . . .
    If there is no time in column B, then the calculation returns 00:00. Is there anyway this can be returned as blank?

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: IF function formula to specify time based on day of the week

    can 0:00 EVER be a correct answer? If not:

    =IFERROR(1/(1/INDEX($B$1:$B$7,MATCH(TEXT($E$1,"ddd"),$A$1:$A$7,0))),"")
    Attached Files Attached Files

  10. #10
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,466

    Re: IF function formula to specify time based on day of the week

    A little bit another approach (also works in non-English speaking countries)

    Try in Cel A1: =WEEKDAY(MOD(SEQUENCE(7),7)+1)
    Try in Cel E3: =IFERROR(1/(1/INDEX(B1:B7,MATCH(WEEKDAY(E1),A1#,0))),"")
    Everything seems the same!

    By the way: Instead of "IFERROR(1/(1/" it is also possible to change the format of CEL E3 to "hh:mm;;" In that case, 0:00 is also made invisible.
    Attached Files Attached Files
    Last edited by HansDouwe; 08-17-2022 at 12:59 PM.

+ 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 Absence in a Time sheet based on working days per week!
    By BassemCh in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-01-2021, 03:36 AM
  2. Replies: 1
    Last Post: 12-17-2020, 04:09 AM
  3. [SOLVED] Help Charting Data based on Day of Week and Time of Arrival
    By donnyjtaylor in forum Excel Charting & Pivots
    Replies: 5
    Last Post: 12-15-2015, 02:30 AM
  4. Replies: 5
    Last Post: 09-01-2014, 03:55 PM
  5. [SOLVED] check a date and return different values based on time and day of week
    By garyfahy in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-22-2014, 07:26 AM
  6. Replies: 10
    Last Post: 09-25-2012, 09:24 AM
  7. IF Function Formula Based On Time.
    By artiststevens in forum Excel General
    Replies: 4
    Last Post: 12-15-2010, 08:22 AM

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