+ Reply to Thread
Results 1 to 4 of 4

Help with countif formula for calendar (countif any date in table present)

  1. #1
    Registered User
    Join Date
    08-15-2018
    Location
    Saskatchewan, Canada
    MS-Off Ver
    Office 2019
    Posts
    21

    Help with countif formula for calendar (countif any date in table present)

    Hi,

    I was hoping to get a little bit more help on an another (and last) formula for my companys work schedule. I'm trying to calculate which employees have worked on a bunch of specific dates (stat holidays). I have figured out the formulas to calculate the date of each holiday as they will vary from year to year. These dates are in a table on a sheet called LOCKED. I have put the formula in the sheet called STATS in cell F5. I want it to see if any of the dates in the table are present in the sheet called schedule (Schedule!$B$3:$AF$3) for the selected month. If they are count the cell for that date in the row employee 1 (Schedule!$B$5:$AF$6) if it has a 1 or a 2 in that cell signifying if the worked shift 1, shift 2. Otherwise do nothing. I have figured out the formula for only one date in the list at a time and it has to be the same month as the date selected. For example if I have the calendar set for December 2021 (calendar days adjust automatically when the month and year are chosen) and I have the date chosen on the list to December 25, 2021 it works, If I change the month to February I get a #N/A This is what I have so far. =COUNTIF(INDEX(Employee1, 0, MATCH(LOCKED!F5, Month_Numbers, 0)), "1")+COUNTIF(INDEX(Employee1, 0, MATCH(LOCKED!F5, Month_Numbers, 0)), "2"). The problem that I am having is I can't figure out how to create the formula to see if there are any of the dates present in the selected month not just one and regardless of which month is selected. As well as if there are more than one (December has 2 Christmas Day and Boxing Day). I'm not sure if I am on the right track to accomplish this or not but any help would be greatly appreciated. I have attached a file below.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,169

    Re: Help with countif formula for calendar (countif any date in table present)

    I made the following changes:

    Named range "Stat_Hols" for holiday list in column F of "Locked"

    Changed named ranges "Employeex" to reference the first line of the (effectively merged) cell reference

    in "Stats" F5

    =IFERROR(SUMPRODUCT(--(Month_Numbers=Stat_Hols)*(INDIRECT(SUBSTITUTE(A5," ",""))>=1)),"").

    OR

    in Column G

    =IFERROR(SUMPRODUCT(--(Month_Numbers=Stat_Hols)*(INDEX(Schedule!$B$5:$AF$32,MATCH($A5,Schedule!$A$5:$A$32,0),0)>=1)),"")

    Removes the need of "Employeex" named ranges

    Copy down

    I strongly urge you to remove the "merging" of "Employee" and "Telephone" by putting "Telephone" in its own column to avoid unnecessary complications to formulae.

    It is "pretty" but not "practical": in fact, bad practise.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    08-15-2018
    Location
    Saskatchewan, Canada
    MS-Off Ver
    Office 2019
    Posts
    21

    Re: Help with countif formula for calendar (countif any date in table present)

    Thank you so much for your assistance. I will have to see what my employer wants to do in regards to the phone number cells. It's set up this was so that when it's printed it fits on one page. I do agree with you that it's not the best for the solution. Now that it's done all cells that have formulas will be locked and hidden. The person imputing the scheduling information will only be able to select and input numbers where they need to.

    Once again I really do appreciate you taking the time to help me out!

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,169

    Re: Help with countif formula for calendar (countif any date in table present)

    You're welcome.

+ 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] Countif date on each table row is between specific dates
    By oriyuno in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-27-2019, 05:11 AM
  2. Adding a COUNTIF function to an existing IF AND COUNTIF Formula...
    By Ourkid123uk in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-24-2018, 10:09 AM
  3. Faster if/countif formula for flagging uniques - countif too slow
    By Speshul in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-19-2015, 01:44 PM
  4. countif formula for column containing day of week from calendar userform
    By stuu3270 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-10-2013, 08:10 AM
  5. Replies: 1
    Last Post: 11-09-2011, 04:45 AM
  6. Combining a Date Range COUNTIF and a general COUNTIF
    By jacobtom in forum Excel General
    Replies: 1
    Last Post: 09-15-2011, 05:06 PM
  7. Countif Where Date Present in Previous column
    By Mikem0st in forum Excel General
    Replies: 2
    Last Post: 01-07-2011, 09:45 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