+ Reply to Thread
Results 1 to 7 of 7

Trouble with COUNTIF, to count a cell or not

  1. #1
    Registered User
    Join Date
    08-04-2013
    Location
    Michigan
    MS-Off Ver
    Excel 2010 and 2013
    Posts
    10

    Trouble with COUNTIF, to count a cell or not

    I have a tracking spreadsheet that covers the movement of people in a care facility. I have a COUNTIF string to cover the days of the month, however I need to find a formula to start off that string with, that will do the following:

    If cell A6 (Last Name) is blank then do not count cells M6 through AQ6(my days of the month). If A6 has text then count M6 through AQ6 using COUNTIF formula I have in place, which is located in cell BC6
    =COUNTIF(M6:AQ6,"")+COUNTIF(M6:AQ6,"HLV")+COUNTIF(M6:AQ6,"TLV")+COUNTIF(M6:AQ6,"ADM")+COUNTIF(M6:AQ6,"RTN")+COUNTIF(M6:AQ6,"LCCN")
    Master SS 31 DAYS.xlsm

    Any ideas?

    Thank you in advance.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Trouble with COUNTIF, to count a cell or not

    I know there is a better way of doing this, just cant thing of it at the moment, but try this...
    =IF(COUNTIF(M6:AQ6,"")=COUNT($M$5:$AQ$5),"",COUNTIF(M6:AQ6,"HLV")+COUNTIF(M6:AQ6,"TLV")+COUNTIF(M6:AQ6,"ADM")+COUNTIF(M6:AQ6,"RTN")+COUNTIF(M6:AQ6,"LCCN"))
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    08-04-2013
    Location
    Michigan
    MS-Off Ver
    Excel 2010 and 2013
    Posts
    10

    Re: Trouble with COUNTIF, to count a cell or not

    Sorry to say that did not work. I changed $M$5:$AQ$5 to $M$6:$AQ$6 but I need to have BC6 read 31 if there is a name in A6, then it subtracts those items identified in the COUNTIF string. Yours started at zero (0) and then added anything placed into the cells.

    Kirk.

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Trouble with COUNTIF, to count a cell or not

    No, the $M$5:$AQ$5 needs to stay exactly that. It is counting the days in your month. I used that to cater for 30 and 28 day months.

    So, If I understand you correctly, you want to count those entries NOT = to HLV,TLV,ADM,RTN or LCCN?

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Trouble with COUNTIF, to count a cell or not

    Maybe try this?
    =COUNTIFS(M6:AQ6,"<>HLV",M6:AQ6,"<>TLV",M6:AQ6,"<>ADM",M6:AQ6,"<>RTN",M6:AQ6,"<>LCCN")

  6. #6
    Registered User
    Join Date
    08-04-2013
    Location
    Michigan
    MS-Off Ver
    Excel 2010 and 2013
    Posts
    10

    Re: Trouble with COUNTIF, to count a cell or not

    We might not be on the same track/page here. The COUNTIF formula I have currently works fine, it starts at 31 for the days of the month. The COUNTIF do not count against the 31 days, however I do have other entries that do count against the 31 days. What I am looking for is to have the A6 trigger the COUNTIF formula for row 6. So if there is a last name in A6, the formula will count cells M6-AQ6 using my COUNTIF formula and show up in BC6. However if cell A6 is empty/blank, the COUNTIF formula does not kick in and cell BC6 is either ZERO or FALSE.

    I have two other spreadsheets set up to reflect the 28 and 30 days, once I have a working formula I will copy to those as well.

    Hope this explains it a little better.
    Last edited by HSCM; 07-09-2014 at 10:33 PM.

  7. #7
    Registered User
    Join Date
    08-04-2013
    Location
    Michigan
    MS-Off Ver
    Excel 2010 and 2013
    Posts
    10

    Re: Trouble with COUNTIF, to count a cell or not

    Thanks for the help, but I have worked on the formula and came up with this to make it work. =IF(A399="","0","1")*

    Thanks again.

+ 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 Trouble
    By Shadefalcon in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-22-2013, 02:44 PM
  2. [SOLVED] COUNTIF trouble
    By pushkinpassey in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-28-2013, 12:15 PM
  3. Excel 2007 : Trouble with countif
    By TurnerZ in forum Excel General
    Replies: 5
    Last Post: 01-05-2010, 06:38 AM
  4. Trouble Using COUNTIF and AND
    By pafranklin in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-24-2007, 09:59 AM
  5. [SOLVED] countif trouble
    By Craig in forum Excel General
    Replies: 1
    Last Post: 12-29-2005, 07:10 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