+ Reply to Thread
Results 1 to 12 of 12

COUNTIFS - am I using it correctly?

Hybrid View

  1. #1
    Registered User
    Join Date
    02-10-2011
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    11

    COUNTIFS - am I using it correctly?

    I have attached a screenshot of a leave planner I am in the middle of creating. I have come across one issue I am struggling with and wonder if I am using COUNTIFS correctly at row 24?


    Row 8 shows how many staff (by percentage) can be on leave at any one time. Row 24 (which will be hidden) contains the following formula (Column P used in this example):

    =COUNTIFS($D32:$D45,"AO",$E32:$E45,"<>"&P$30)/100*P8

    So, if a member of staff leaves the section to work elsewhere a date is put into column E and from this date onward (cells are dark greyed out to say they no longer work on the section) I am trying to reduce the number allowed on leave (U24 is showing the correct amount of 1.98). What I am trying to achieve in this example is to have cells V-Z Row 24 also display the value at U24 (1.98).

    I need to leave the staff member on the leave planner even if they have left the section, because if they were removed it would affect all percentages across the whole spreadsheet (Row 24).

    Row 23 is just Row 24 rounded up.

    I've been stuck on this problem for over 2 weeks, so have finally decided to ask for some guidance/help.

    Many thanks for viewing.

    Paul S

    ssheet_Page_1.jpg

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: COUNTIFS - am I using it correctly?

    You ask if you're using COUNTIF correctly. Perhaps a more pertinent question is is COUNTIF giving me the right answers, and only you can comment on that.
    If it's not then upload the workbook, pictures are rarely if ever much use, manually add some typical results that you expect and explain how you have calculated the results.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    02-10-2011
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: COUNTIFS - am I using it correctly?

    Please excuse my ignorance - my settings must have changed as I could not see the upload attachment button anywhere and I thought it may have been removed from the forum.

    I have now uploaded a smaller version of my spreadsheet (all Macros have been removed). The Leave Planner starts out with 14 members of staff at 1 Jan 2015 and 18% of these are allowed time off at any one time, equating to 2.52 allowed off (which is rounded up to 3). Now, 3 people leave the section on 5/1/15, leaving 11 in total (from 5/1/15). This means that the number allowed on leave falls to 1.98 (rounded up to 2). My problem is that I can get the correct figure to display on the 5/1/15, but anything after then reverts back to 2.52. The formula I have at Row 24 is:

    =COUNTIFS($D32:$D53,"AO",$E32:$E53,"<>"&T$30)/100*T8

    which, as I have said, does give me the correct result, but only for the 1 day. Everything after 5/1/15 also needs to be showing as 1.98.

    Regards

    Paul S
    Attached Files Attached Files

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: COUNTIFS - am I using it correctly?

    Hi,

    Maybe in T24 copied across

    Formula: copy to clipboard
    =IF(COUNTIF($E$32:$E$52,T30)=0,S24,COUNTIFS($D32:$D53,"AO",$E32:$E53,"<>"&T$30)/100*T8)

  5. #5
    Registered User
    Join Date
    02-10-2011
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: COUNTIFS - am I using it correctly?

    Richard,

    Many thanks for your reply. I have tried your formula as well and it gives the same results as Quang PT. Please see my reply to Quang PT.

    Regards

    Paul S

  6. #6
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: COUNTIFS - am I using it correctly?

    ...How about in T24


    Formula: copy to clipboard
    =(COUNTIFS($E$32:$E$52,"",$D$32:$D$52,"AO")+COUNTIF($E$32:$E$52,">"&T30))/100*T8

  7. #7
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,658

    Re: COUNTIFS - am I using it correctly?

    May be: From Q24 and drag accross:

    =IF(COUNTIF($E$32:$E$53,Q$30)>0,COUNTIFS($D32:$D53,"AO",$E32:$E53,"<>"&Q$30)/100*Q8,P$24)
    Quang PT

  8. #8
    Registered User
    Join Date
    02-10-2011
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: COUNTIFS - am I using it correctly?

    Hi Quang PT

    Many thanks for your reply. I thought it had done it; however, if someone else leaves the section on, say 8/1/15, then the number goes up from 1.98 to 2.34 from 8/1/15 onwards - I would have thought the number would have been less?

    Thanks

    Paul S

  9. #9
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,658

    Re: COUNTIFS - am I using it correctly?

    Try in P24:

    =SUMPRODUCT(($D32:$D53="AO")*(($E32:$E53="")+($E32:$E53>P$30)))/100*P8

  10. #10
    Registered User
    Join Date
    02-10-2011
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: COUNTIFS - am I using it correctly?

    Hi Quang PT

    Your message just came in as I was thanking Richard (and your first message). This solution works as well.

    Many thanks indeed

    Regards

    Paul S

  11. #11
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,658

    Re: COUNTIFS - am I using it correctly?

    Nice to hear it works, Paul S.
    please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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] Countifs + Countifs - replacement?
    By JulieQ in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-05-2015, 03:02 PM
  2. Excel COUNTIFS not counting data correctly
    By Linda Borza in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 08-21-2013, 09:19 PM
  3. COUNTIFS OR COUNTIFS needs to work
    By joshbellfi in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-23-2013, 10:55 AM
  4. COUNTIFS OR...multiple countifs without duplication in the numbers
    By HooligaD in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-21-2012, 09:53 AM
  5. Replies: 0
    Last Post: 12-16-2011, 09:01 AM
  6. CSE Sum-if not working correctly
    By krjohnso in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-30-2009, 05:08 PM
  7. Open CSV correctly
    By Amirallia in forum Excel General
    Replies: 5
    Last Post: 08-06-2006, 05:15 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