+ Reply to Thread
Results 1 to 10 of 10

COUNTIFS with many criteria

Hybrid View

  1. #1
    Registered User
    Join Date
    10-03-2022
    Location
    Singapore
    MS-Off Ver
    Microsoft 2016
    Posts
    7

    COUNTIFS with many criteria

    How can I perform a COUNTIFS with many different criteria such as having to search a column with a specific text, another column with either 0 or more than 0 and lastly, another which compares time in am/pm (e.g. 1L, 0, 10.00am-6pm). Please see file as attached.

    Would sincerely appreciate any help. Thank you!
    Attached Files Attached Files
    Last edited by Greenbeansprout; 10-04-2022 at 11:49 PM.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,414

    Re: COUNTIFS with many criteria

    I'm not sure why your date/time needs to occupy 4 columns merged across, but it would be simpler for you to separate the time into another column. You can do that by using this formula in G2:

    =MOD(C2,1)

    Format as a time in the style you prefer, then copy down. Then you can use this formula for your count, based on the example that you quote:

    =COUNTIFS(A:A,"1L*",B:B,">0",G:G,">="&TIME(10,0,0),G:G,"<"&TIME(18,0,0))

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    10-03-2022
    Location
    Singapore
    MS-Off Ver
    Microsoft 2016
    Posts
    7

    Re: COUNTIFS with many criteria

    Hi Pete,

    Thank you so much in helping to address this. I had tried the formula which responded but when I attempt to swap the time around, it doesn't seem to be picking the right numbers. Am I right to assume that the numbers in brackets refer to the hours, mins and secs and that it doesn't matter if my current text in the cells are in AM and PM?

    When I tried to swap it to =COUNTIFS(A:A,"1L*",B:B,">0",G:G,">="&TIME(14,0,0),G:G,"<"&TIME(17,0,0)) , it should be picking up 2 but then it appeared as 0. Did I make a mistake in configuring the time? I tried the formula at Cell I2

    Thanks

    Attachment 798985

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,414

    Re: COUNTIFS with many criteria

    I can't open your attachment - please re-attach it using the procedure outlined in the yellow banner at the top of the screen.

    Pete

  5. #5
    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
    90,606

    Re: COUNTIFS with many criteria

    There is no formula, there are no expected results. Please provide a more detailed (annotated) workbook with expected results mocked up manually.
    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.

  6. #6
    Registered User
    Join Date
    10-03-2022
    Location
    Singapore
    MS-Off Ver
    Microsoft 2016
    Posts
    7

    Re: COUNTIFS with many criteria

    Pardon on attaching an image and not an attachment. It is as shown.

    Thanks
    Attached Files Attached Files

  7. #7
    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
    90,606

    Re: COUNTIFS with many criteria

    Where are your expected results? There are no annotations in the workbook to explain what you are trying to do.

  8. #8
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,414

    Re: COUNTIFS with many criteria

    You are getting zero in cell I2 because nothing matches your criteria. Change the formula to this:

    =COUNTIFS(A:A,"1K*",B:B,">0",G:G,">="&TIME(14,0,0),G:G,"<"&TIME(17,0,0))

    and you will get a result of 2, showing that the formula is working correctly.

    Hope this helps.

    Pete

  9. #9
    Registered User
    Join Date
    10-03-2022
    Location
    Singapore
    MS-Off Ver
    Microsoft 2016
    Posts
    7

    Re: COUNTIFS with many criteria

    Oh my, how could I miss that! But it sure did solved the issue.

    Sincerely, thank you!

  10. #10
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,414

    Re: COUNTIFS with many criteria

    Thanks for marking the thread as Solved.

    Also, since you are relatively new to the forum, you might like to know that you can directly thank those who have helped you by clicking on the small "star" icon located in the lower left corner of a post that you have found to be helpful (not just in this thread - for any post that has helped you). This also adds to the reputation of the poster (the small green bars in the poster's profile).

    Pete

+ 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 AND Criteria on the same criteria range WILDCARD and to exlude
    By dluhut in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-28-2022, 05:00 PM
  2. [SOLVED] COUNTIFS formula to count for 2 criteria inside one criteria area
    By signekolind in forum Excel General
    Replies: 4
    Last Post: 08-07-2019, 04:39 AM
  3. [SOLVED] Countifs multiple criteria- criteria if cell is greater than another i adjacent column
    By Sircool1 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-26-2018, 11:23 AM
  4. [SOLVED] Countifs one criteria range multi dynamic cells as criteria
    By brake in forum Excel Formulas & Functions
    Replies: 26
    Last Post: 03-10-2018, 08:00 AM
  5. [SOLVED] COUNTIFS with Multiple Text Criteria in Same Criteria Range
    By xl2016 in forum Excel General
    Replies: 5
    Last Post: 06-18-2017, 05:00 AM
  6. Countifs with multiple criteria in single criteria range
    By MCP313 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 12-01-2016, 03:51 AM
  7. Replies: 2
    Last Post: 11-06-2012, 06:40 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