+ Reply to Thread
Results 1 to 10 of 10

Count cells two different criteria and consider as single value if both criteria match

  1. #1
    Registered User
    Join Date
    05-27-2013
    Location
    BANGALORE, INDIA
    MS-Off Ver
    Excel 2013
    Posts
    45

    Count cells two different criteria and consider as single value if both criteria match

    Please help me i am new to excel world,

    I have three columns, Column A contains patient name, Column B contains Systolic blood pressure(SBP), Column C contains Diastolic blood pressure(DBP). If systolic blood pressure is more than or equal to 140 or diastolic blood pressure is more than or equal to 90, I consider patient is having Hypertension.

    I have 1000 patients. Now i want to count how many patients are having Hypertension. If a patient has both SBP>140 and DBP>90 then i want to count it as one patient.

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

    Re: Count cells two different criteria and consider as single value if both criteria mat

    Are you really using XL2003? If not, please amend your profile.

    Try this formula:

    =SUMPRODUCT(($B$1:$B$1000>=140)+($C$1:$C$1000>=90))

    Hope this helps.

    Pete

  3. #3
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Count cells two different criteria and consider as single value if both criteria mat

    hi rudswa, welcome to the forum. try:
    =SUMPRODUCT(--(((B2:B20>=140)+(C2:C20>=90))>0))

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Count cells two different criteria and consider as single value if both criteria mat

    Here's another one...

    =SUMPRODUCT(SIGN((B2:B1000>=140)+(C2:C1000>=90)))
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Count cells two different criteria and consider as single value if both criteria mat

    Quote Originally Posted by Pete_UK View Post
    =SUMPRODUCT(($B$1:$B$1000>=140)+($C$1:$C$1000>=90))
    If both conditions are met on a single row that will count it as 2 instances.

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

    Re: Count cells two different criteria and consider as single value if both criteria mat

    Well, I didn't have an example file to test it out on !!

    Pete

  7. #7
    Registered User
    Join Date
    05-27-2013
    Location
    BANGALORE, INDIA
    MS-Off Ver
    Excel 2013
    Posts
    45

    Re: Count cells two different criteria and consider as single value if both criteria mat

    THANKS "benishiryo" It worked like charm. And please tell me is there any way to exclude counting TEXTS in the column.

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Count cells two different criteria and consider as single value if both criteria mat

    Quote Originally Posted by rudswa View Post
    is there any way to exclude counting TEXTS in the column.
    Try this...

    =SUMPRODUCT(SIGN(ISNUMBER(B2:B1000)*(B2:B1000>=140)+ISNUMBER(C2:C1000)*(C2:C1000>=90)))

  9. #9
    Registered User
    Join Date
    05-27-2013
    Location
    BANGALORE, INDIA
    MS-Off Ver
    Excel 2013
    Posts
    45

    Re: Count cells two different criteria and consider as single value if both criteria mat

    Quote Originally Posted by Tony Valko View Post
    Try this...

    =SUMPRODUCT(SIGN(ISNUMBER(B2:B1000)*(B2:B1000>=140)+ISNUMBER(C2:C1000)*(C2:C1000>=90)))
    Thanks a lot this worked perfectly.....

  10. #10
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Count cells two different criteria and consider as single value if both criteria mat

    You're welcome. Thanks for the feedback!

+ 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