+ Reply to Thread
Results 1 to 7 of 7

Need help combining Countifs with sumproduct

  1. #1
    Registered User
    Join Date
    02-09-2019
    Location
    India
    MS-Off Ver
    Office 2019
    Posts
    9

    Need help combining Countifs with sumproduct

    This is my first post so first of all, wanted to say Hello to everyone.
    Now I am working on a Google spreadsheet and have several tabs with names in column A so I made column A dynamic and as soon as I add a name of a tab in column A1 it should check 4 conditions in that tab

    1. Check Column L and see if we have "Track-LPH12"
    2. Check Column AG and see if we have Either "Waiting, Valid or Invalid"
    3. Check Column Q and see if there is any thing (notes)
    4. Check Column X and see if there is any thing (sub notes)

    ARRAYFORMULA(IF($A1="",,COUNTIFS(INDIRECT($A1&"!$L:$L"),"Track-LPH12",INDIRECT($A1&"!$AG:$AG"),"Waiting",INDIRECT($A1&"!$Q:$Q"),"*",INDIRECT($A1&"!$X:$X"),"*")+COUNTIFS(INDIRECT($A1&"!$L:$L"),"Track-LPH12",INDIRECT($A1&"!$AG:$AG"),"Valid",INDIRECT($A1&"!$Q:$Q"),"*",INDIRECT($A1&"!$X:$X"),"*")+COUNTIFS(INDIRECT($A1&"!$L:$L"),"Track-LPH12",INDIRECT($A1&"!$AG:$AG"),"Invalid",INDIRECT($A1&"!$Q:$Q"),"*",INDIRECT($A1&"!$X:$X"),"*")))

    Now the given formula works fine but if you see we have 3 conditions (Point 1, 3 and 4) which are same for all and only condition 2 changes "Waiting, Valid or Invalid", so I have to write full formula for 'Waiting' + same formula for 'Valid' and 'Invalid'

    COUNTIFS(INDIRECT($A1&"!$L:$L"),"Track-LPH12",INDIRECT($A1&"!$AG:$AG"),"Waiting",INDIRECT($A1&"!$Q:$Q"),"*",INDIRECT($A1&"!$X:$X"),"*")+
    COUNTIFS(INDIRECT($A1&"!$L:$L"),"Track-LPH12",INDIRECT($A1&"!$AG:$AG"),"Valid",INDIRECT($A1&"!$Q:$Q"),"*",INDIRECT($A1&"!$X:$X"),"*")+
    COUNTIFS(INDIRECT($A1&"!$L:$L"),"Track-LPH12",INDIRECT($A1&"!$AG:$AG"),"Invalid",INDIRECT($A1&"!$Q:$Q"),"*",INDIRECT($A1&"!$X:$X"),"*")))


    Is there a way that we can combine "Waiting, Valid or Invalid" instead of writing individual formula for each and then add them one by one, I am thinking to add 2~3 more data set for condition 2 so the formula will become too big and prone to errors.

    I think there is a way to use sumproduct along with countifs but, can't make it work.

    Please help

    Thanks

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    79,375

    Re: Need help combining Countifs with sumproduct

    Welcome to the forum!¬

    I've moved your thread, as it is not about Excel, but Google Sheets.
    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.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: Need help combining Countifs with sumproduct

    It won't be any more efficient but, yes, you can shorten the syntax:

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    FWIW, I'd suggest two things;

    1 - avoid use of entire column references if you can, even with COUNTIFS -- but particularly when used in Volatile context like the above {given INDIRECT}
    2 - you may want to use ?* rather than * for you "any note" search as * would find a Null string ("") for ex. where as ?* would not (must be 1 char)

    on an aside, in reference to point 1 above, I would advise against using SUMPRODUCT alternatives (where you would use + to conduct an OR based test)

  4. #4
    Registered User
    Join Date
    02-09-2019
    Location
    India
    MS-Off Ver
    Office 2019
    Posts
    9

    Re: Need help combining Countifs with sumproduct

    Thanks AliGW for warm welcome and moving to the correct section

    XLent Thanks a lot for such a quick reply and noted about your suggestions
    Regarding the formula as you can see in screenshot below, Its not counting all the 3 conditions ("Waiting","Valid","Invalid") where as its only counting first entry "Waiting"

    From the Screenshot you can see row no. 9 "Aleksander" Column D, E and F have individual values and in column P where I put the new formula it only show Value 85 which matches with the data for Waiting where as its not adding up data for Valid and Invalid. Same goes for next column "Alex".

    Please advice
    P.S. I am not allowed to post any picture or link so please advice how can i post a screenshot to show what are those columns stands for

  5. #5
    Registered User
    Join Date
    02-09-2019
    Location
    India
    MS-Off Ver
    Office 2019
    Posts
    9

    Re: Need help combining Countifs with sumproduct

    Made it to work Just used Sumproduct instead of Sum and its working perfect. Thanks everyone for the help

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    79,375

    Re: Need help combining Countifs with sumproduct

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  7. #7
    Registered User
    Join Date
    02-09-2019
    Location
    India
    MS-Off Ver
    Office 2019
    Posts
    9

    Re: Need help combining Countifs with sumproduct

    Done and thanks for the help. Appreciated

+ 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] Combining COUNTIFS with VLOOKUP?
    By jeptik in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 06-08-2018, 01:59 PM
  2. [SOLVED] Combining COUNTIFS with VLOOKUP
    By jeptik in forum Excel Formulas & Functions
    Replies: 22
    Last Post: 05-01-2017, 08:31 AM
  3. [SOLVED] Sumproduct to replace countifs as countifs don't work on external source reference
    By KrishnaSagar in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-02-2017, 02:33 AM
  4. Combining Indirect with Countifs
    By arthurphil in forum Excel General
    Replies: 7
    Last Post: 01-27-2015, 08:13 AM
  5. [SOLVED] Combining CountIfS Formulas
    By Phil Hageman in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-21-2013, 09:25 AM
  6. Combining COUNTIFS and OR function
    By tatyanamarie in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-12-2013, 08:51 AM
  7. [SOLVED] Combining two COUNTIFS
    By fletch8701 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-19-2012, 11:07 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