+ Reply to Thread
Results 1 to 14 of 14

Count if formula for multiple columns

  1. #1
    Registered User
    Join Date
    01-23-2019
    Location
    toronto
    MS-Off Ver
    2010
    Posts
    42

    Count if formula for multiple columns

    Hi
    I am need help with a formula

    I am trying to create a formula for Cell H3 on attached worksheet,
    If the drop down in G3 is a month i want the formula to count all the "true" data in column B, and if the Drop down is a quarter(like Q3), i want it to count all "True" cells in column C.

    I have no clue as to what formula i can write that would sort between columns B&C to count the "true" cells.

    Please see attached workbook for test data
    Test Data.xlsx

  2. #2
    Valued Forum Contributor loginjmor's Avatar
    Join Date
    01-31-2013
    Location
    Cedar Rapids, Iowa
    MS-Off Ver
    Excel 2013
    Posts
    1,073

    Re: Count if formula for multiple columns

    Hi -

    A little clarification: If it's a month, say March, you want to count up the TRUE values only for dates in March? And if it's a quarter, say 3rd quarter, you only want to count the TRUE values that occur in Q3 (July, August, September)? Is that correct? If so, you don't really need two columns, unless there is something else different about the months versus the quarters?
    ____________________________________________
    If this has solved your problem, please edit the thread title to add the word [SOLVED] at the beginning. You can do this by
    -Go to the top of the first post
    -Select Thread Tools
    -Select Mark thread as Solved

    If I have been particularly helpful, please "bump" my reputation by pressing the small star in the lower left corner of my post.

  3. #3
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Count if formula for multiple columns

    Mmm...thinking
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  4. #4
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: Count if formula for multiple columns

    Updated in the file, as I cannot post the formula
    No need for column B and C, but you need your date in A1 to be actual date. And you can format it as mmm-yyyy
    Attached Files Attached Files
    Last edited by PaulM100; 10-10-2019 at 11:02 AM.
    Click the * to say thanks.

  5. #5
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Count if formula for multiple columns

    =SUMPRODUCT((TEXT(A$5:A$1000,"mmm-yyyy")=G3)*(B5:B1000=TRUE))+SUMPRODUCT(("Q"&(ROUNDUP(MONTH(A$5:A$1000)/3,0)&"-"&YEAR(A$5:A$1000))=G3)*(C5:C1000=TRUE))

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,098

    Re: Count if formula for multiple columns

    You would not want to see the monster that I was spawning. truly awful!!
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: Lá fhéile Pádraig sona dhaoibh

  7. #7
    Registered User
    Join Date
    01-23-2019
    Location
    toronto
    MS-Off Ver
    2010
    Posts
    42

    Re: Count if formula for multiple columns

    That is correct,
    The users of the file, will have a drop down menu, to select either a Month or the Quarter. I didn't know how to show the data in 1 column hence the 2 columns,

  8. #8
    Registered User
    Join Date
    01-23-2019
    Location
    toronto
    MS-Off Ver
    2010
    Posts
    42

    Re: Count if formula for multiple columns

    Thanks so much for this, I looked at the file, it works perfectly for Month calculation but, i doesn't seem to be counting the correct amount for the quarterly data

  9. #9
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: Count if formula for multiple columns

    May falls in Quarter 2(April,May,June). If you filter on those 3 months in 2019, column A, is gonna return 7 results. You C column is wrong

    Edit: If you are gonna use a month, but a different quarter(Q3 in your example, then use the other formula provided by Special-K or combine mine with his.

  10. #10
    Registered User
    Join Date
    01-23-2019
    Location
    toronto
    MS-Off Ver
    2010
    Posts
    42

    Re: Count if formula for multiple columns

    Quote Originally Posted by Special-K View Post
    =SUMPRODUCT((TEXT(A$5:A$1000,"mmm-yyyy")=G3)*(B5:B1000=TRUE))+SUMPRODUCT(("Q"&(ROUNDUP(MONTH(A$5:A$1000)/3,0)&"-"&YEAR(A$5:A$1000))=G3)*(C5:C1000=TRUE))
    This formula worked perfectly, Thank you. i have an additional ask, if i wanted to add another criteria, like user name,so i want to count a specific users during either the selected timeframe( either month or quarter). for example: John had 4 "TRUE" is Q3-2019. how would i do that
    Attachment 644973

  11. #11
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,834

    Re: Count if formula for multiple columns

    I could not download your file, so in the file attached, I inserted at Col B and typed in "John" in some cells. In cell I3 I have this formula:

    Please Login or Register  to view this content.
    Attached Files Attached Files

  12. #12
    Forum Expert
    Join Date
    09-30-2019
    Location
    Chiangmai, Thailand
    MS-Off Ver
    Office 2016, Excel 2019
    Posts
    1,234

    Re: Count if formula for multiple columns

    Just find "Q" in drop down list.
    (Because no months is contain 'Q')

    H3
    =IFERROR(IF(FIND("Q",G3),COUNTIF($C:$C,TRUE)),COUNTIF($B:$B,TRUE))

    Regards.

  13. #13
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,616

    Re: Count if formula for multiple columns

    heres another one wrt names:
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Ben Van Johnson

  14. #14
    Registered User
    Join Date
    01-23-2019
    Location
    toronto
    MS-Off Ver
    2010
    Posts
    42

    Re: Count if formula for multiple columns

    Thank you, it worked perfectly

+ 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] Formula to count matches between multiple columns on different sheets w/ multiple criteria
    By RICK JAMES in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-05-2019, 03:28 PM
  2. Need a faster formula to count dups in multiple columns
    By Speshul in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-28-2017, 09:13 PM
  3. Formula for count across multiple columns
    By thekid22 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-28-2016, 05:46 PM
  4. [SOLVED] Sort and Count Unique List Across Multiple Columns - Student Count
    By BuntyMac in forum Excel Formulas & Functions
    Replies: 22
    Last Post: 08-17-2014, 07:00 AM
  5. Replies: 1
    Last Post: 03-28-2013, 01:48 PM
  6. [SOLVED] Need formula to count multiple criteria in 2 columns
    By tancho321 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-22-2013, 04:53 PM
  7. Replies: 2
    Last Post: 01-14-2009, 04:01 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