+ 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
    4

    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
    Ipswich, England
    MS-Off Ver
    Excel 2016 (Win 10 - Work) & 365 Subscription (Win 10 - Home)
    Posts
    23,045

    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!

    STOP PRESS: Forum Rules Updated September 2018! Please read them here.
    If anyone has helped you towards solving a problem, then you can thank them by clicking on their reputation star bottom left.

  3. #3
    Valued Forum Contributor
    Join Date
    10-13-2010
    Location
    UK
    MS-Off Ver
    various
    Posts
    471

    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
    4

    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
    4

    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
    Ipswich, England
    MS-Off Ver
    Excel 2016 (Win 10 - Work) & 365 Subscription (Win 10 - Home)
    Posts
    23,045

    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
    4

    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)

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