+ Reply to Thread
Results 1 to 7 of 7

Need a formula that checks date, & returns holiday name or name of location based on day

  1. #1
    Registered User
    Join Date
    04-21-2016
    Location
    Japan
    MS-Off Ver
    2010
    Posts
    2

    Need a formula that checks date, & returns holiday name or name of location based on day

    I am trying to make a formula for a cell that checks whether or not the date next to it is a holiday...If true, it outputs the holiday name. If false, it outputs a location name based on the day of the week. I have been able to do each of these separately (holiday output and location output), but can't think of how to do it together. On days that are a holiday, I don't need the location.

    I have a calendar with all the dates automatically filled in (column A). It also changes the color for weekends, and a different color for holidays. I used nested if statements to have it check my list of holidays (in Japan), and return the name of the holidays in the next column (column B) for days that are holidays. What I would like it to do, is to write a location name in column B, for days that are not holidays, based on the day of the week. So, if it is a holiday, the holiday name would appear. If not, a location name would appear, based on the day of the week (Monday & Tuesday: LOCATION 1, Wednesday & Thursday: LOCATION 2, FRIDAY: LOCATION 3, Sat & Sun: blank).

    I can do this using nested IF statements for either the holiday check or the weekday check, but not together. There is probably an easier way to do this than nested IF statements, but I can't figure it out. If there was an ELSE statement in Excel, I would use the formula "(nested IF statements to check for holidays) ELSE (nested IF statements to fill in locations).
    Attached Files Attached Files

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Need a formula that checks date, & returns holiday name or name of location based on d

    Try the below in cell B4 and copy down for one way of accomplishing this:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    BSB

  3. #3
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Need a formula that checks date, & returns holiday name or name of location based on d

    Or:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    BSB

  4. #4
    Registered User
    Join Date
    04-21-2016
    Location
    Japan
    MS-Off Ver
    2010
    Posts
    2

    Re: Need a formula that checks date, & returns holiday name or name of location based on d

    Wow!

    Both formulas work perfectly. Much more elegant than the long nested IF statement I was using just for filling in the holidays. I haven't used IFERROR or VLOOKUP before, although I looked into VLOOKUP when I was trying to figure this out. I haven't used IF(OR..) statements yet either, but I'm going to spend some time figuring out what you did.

    Thank you so much for helping me with this. I still have a long way to go in learning Excel, and I really appreciate you taking the time to help me with this.

  5. #5
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Need a formula that checks date, & returns holiday name or name of location based on d

    Glad I could help.

    Have fun studying how it all works and feel free to ask all the questions you need if it doesn't make sense. That's what we're here for.

    BSB

  6. #6
    Registered User
    Join Date
    12-31-2020
    Location
    USA
    MS-Off Ver
    Office 2019
    Posts
    44

    Re: Need a formula that checks date, & returns holiday name or name of location based on d

    This formula is awesome. I am trying to apply it to conditional formatting in order to type in the cell if necessary but I am having no luck. Suggestions?

  7. #7
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Need a formula that checks date, & returns holiday name or name of location based on d

    I would suggest starting a new thread (you can reference this thread by linking to it). Attach a sample workbook to your new thread so we can seethe issue in context and explain as fully as you can what your desired output is.

    BSB

+ 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. VBA/Function that checks condition and returns the value of a relative index.
    By mysticmoron109 in forum Excel Programming / VBA / Macros
    Replies: 24
    Last Post: 09-04-2015, 05:07 PM
  2. Replies: 10
    Last Post: 07-14-2015, 12:26 AM
  3. Networkdays with holiday - start date falls on a holiday
    By skexcelforum in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-09-2014, 01:47 AM
  4. Code that checks the last day of a month in a rollbook and returns values
    By Rob.Marchel in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-01-2014, 09:01 PM
  5. [SOLVED] Calculation of End date based on the Names, Should not include Sat, Sun and Holiday
    By Pavan.Sada.PS in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-12-2013, 08:31 AM
  6. [SOLVED] Sum Weekend and Holiday Values Based on a Date Range in another Cell
    By GiGi320 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-27-2012, 11:53 AM
  7. [SOLVED] Formula which checks whether a string is found in a range and checks 2 criteria
    By liranbo in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-30-2012, 05:28 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