+ Reply to Thread
Results 1 to 21 of 21

Counif in vertical list for 2 creterias looking for partial and full text inside cell

  1. #1
    Forum Contributor
    Join Date
    02-15-2016
    Location
    India
    MS-Off Ver
    2016
    Posts
    657

    Counif in vertical list for 2 creterias looking for partial and full text inside cell

    Hello Friends

    In Column A if contains cells E4:E8 (i.e., AAA, BBB or GGG) anywhere inside cell and in Column B if it contains Cells F4:F8 (i.e., X and Y) then need to count in light yellow cells H4 by using formula.

    thanks in advance.
    Sekar

  2. #2
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    2,366

    Re: Counif in vertical list for 2 creterias looking for partial and full text inside cell

    Put on H4 and copied down

    =COUNTIFS($A$1:$A$200,"*"&E4&"*",$B$1:$B$200,F4)

  3. #3
    Forum Contributor
    Join Date
    02-15-2016
    Location
    India
    MS-Off Ver
    2016
    Posts
    657

    Re: Counif in vertical list for 2 creterias looking for partial and full text inside cell

    Instead of writing seperate formulas and summing is there any single formula to count as 43.

  4. #4
    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
    80,351

    Re: Counif in vertical list for 2 creterias looking for partial and full text inside cell

    Try this:

    =SUM(COUNTIFS($A$1:$A$200,"*"&E4:E9&"*",$B$1:$B$200,F4:F9))

    ... confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.
    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.

  5. #5
    Forum Contributor
    Join Date
    02-15-2016
    Location
    India
    MS-Off Ver
    2016
    Posts
    657

    Re: Counif in vertical list for 2 creterias looking for partial and full text inside cell

    This array formula shows result as 22 but it should be 43 even after CTRL+SHIFT+ENTER.

  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
    80,351

    Re: Counif in vertical list for 2 creterias looking for partial and full text inside cell

    Why should it be 42? There are 14 matching the first condition, 8 matching the second and no matches for the third - that makes 22. Is the lookup value missing for the third condition in the workbook?

    Excel 2016 (Windows) 32 bit
    E
    F
    G
    H
    I
    J
    K
    4
    AAA
    X
    43
    Result by formula
    14
    5
    BBB
    Y
    8
    6
    GGG
    0
    7
    Need to be counted
    8
    Sheet: Sheet1

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,146

    Re: Counif in vertical list for 2 creterias looking for partial and full text inside cell

    Try

    =SUMPRODUCT(COUNTIFS(A2:A201,"*" &E4:E6 &"*",B2:B201,"X"))+SUMPRODUCT(COUNTIFS(A2:A201,"*" &E4:E6&"*",B2:B201,"Y"))

    I think the result is 56 if I have interpreted your request correctly.
    Last edited by JohnTopley; 07-31-2017 at 03:24 AM. Reason: Changed ranges as I had added extra row

  8. #8
    Forum Contributor
    Join Date
    02-15-2016
    Location
    India
    MS-Off Ver
    2016
    Posts
    657

    Re: Counif in vertical list for 2 creterias looking for partial and full text inside cell

    No the requirement is if the column A cells contains anywhere `AAA' or `BBB' or `GGG' AND (Not OR) the Column B cells contains `X' or `Y' then need to be counted per light green cells.

    For GGG in Column A and for X or Y in Column B also need to be counted which is omitted. Also for `AAA' Y should be counted, for `BBB' `X' should be counted.

  9. #9
    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
    80,351

    Re: Counif in vertical list for 2 creterias looking for partial and full text inside cell

    Ah, I see, John! Yes, I think you've interpreted it correctly.

  10. #10
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Counif in vertical list for 2 creterias looking for partial and full text inside cell

    I get the same as John with this:

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

  11. #11
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,146

    Re: Counif in vertical list for 2 creterias looking for partial and full text inside cell

    @Dave,
    I'll store your answer as I knew there must be a simpler way to do this type of count.

  12. #12
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,935

    Re: Counif in vertical list for 2 creterias looking for partial and full text inside cell

    with an helper column,

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


    H4
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If I helped, Don't forget to add reputation (click on the little star ★ at bottom of this post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)

  13. #13
    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
    80,351

    Re: Counif in vertical list for 2 creterias looking for partial and full text inside cell

    Please see post #3:
    Instead of writing seperate formulas and summing is there any single formula to count as 43.

  14. #14
    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
    43,984

    Re: Counif in vertical list for 2 creterias looking for partial and full text inside cell

    John I prefer yoursas:

    1) it also works with non-standard strings (e.g. starting with an extra digit)
    2 It's non-array entered
    3) It can be simplified (I think...) to

    =SUMPRODUCT(COUNTIFS($A$1:$A$201,"*" &$E$4:$E$6 &"*",$B$1:$B$201,$G$4:$G$5))
    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

  15. #15
    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
    80,351

    Re: Counif in vertical list for 2 creterias looking for partial and full text inside cell

    That returns 0 here, Glenn.

  16. #16
    Forum Contributor
    Join Date
    02-15-2016
    Location
    India
    MS-Off Ver
    2016
    Posts
    657

    Re: Counif in vertical list for 2 creterias looking for partial and full text inside cell

    Hello

    thanks to all

    John (Non Array), Dave (Array) and Ankur (Non Array with helper) formulas working well.

    Glenn, the formula shows result as 22 but it should be 56.


    thanks again

  17. #17
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,146

    Re: Counif in vertical list for 2 creterias looking for partial and full text inside cell

    @Glenn,
    Your formula (which I also tried) produces an answer of 22: this is why I had the 2 separate SUMPRODUCTS as I could not resolve how the include the F4:F5
    parameters in a single SUMPRODUCT (or any) formula. I am sure there must be way!

  18. #18
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Counif in vertical list for 2 creterias looking for partial and full text inside cell

    @ Glenn

    Good point on the non-standard strings RE: extra digits.

    I'll sleep on it.

  19. #19
    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
    43,984

    Re: Counif in vertical list for 2 creterias looking for partial and full text inside cell

    I pared it down to about 20 rows (easier to follow in evaluate formulae) and it seemed OK.. There was a mistake in the formula that I posted above: it does indeed return 22.

    =SUMPRODUCT(COUNTIFS($A$1:$A$201,"*" &$E$4:$E$6 &"*",$B$1:$B$201,$F$4:$F$5))

    I'll ruminate on this later...

  20. #20
    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
    43,984

    Re: Counif in vertical list for 2 creterias looking for partial and full text inside cell

    The OP is probably Ok with the solution. However, I'm a bit stubborn so I played on with this for a bit...

    On this (pared down) sheet, the various formulae have their strengths and weaknesses, but this seems to work with variable string formats and is nice and short. It is, however, array entered:

    =SUMPRODUCT(COUNTIFS($A$2:$A$20,"*" &$E$5:$E$7 &"*",$B$2:$B$20,TRANSPOSE($G$5:$G$6)))

    i think it's OK...
    Attached Files Attached Files

  21. #21
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Counif in vertical list for 2 creterias looking for partial and full text inside cell

    Quote Originally Posted by Glenn Kennedy View Post
    The OP is probably Ok with the solution. However, I'm a bit stubborn so I played on with this for a bit...
    You and me both. Made this one trying to get to sleep ... LOL

    Array entered ... takes care of any variable prefixes. If the "-" varies that will be a new challenge.

    =SUM((RIGHT(REPLACE(A2:A20,FIND("-",A2:A20),99,""),3)=TRANSPOSE(E5:E7))*COUNTIF(G5:G6,B2:B20))

+ 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. Replies: 5
    Last Post: 07-10-2017, 10:36 AM
  2. [SOLVED] Plotting Date list for the given creterias
    By thilag in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-21-2015, 05:51 AM
  3. [SOLVED] conversion of full and partial date into full format
    By sarat47 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-08-2014, 03:43 PM
  4. VLOOKUP a full text in a partial data field
    By lukeareed in forum Excel General
    Replies: 3
    Last Post: 03-28-2014, 11:13 AM
  5. [SOLVED] Add Data for Full and Partial week
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-29-2013, 04:20 PM
  6. matching partial text within one cell to partial text within another
    By Solstice in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 03-03-2010, 09:13 PM
  7. Replies: 5
    Last Post: 02-01-2005, 04:06 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