+ Reply to Thread
Results 1 to 6 of 6

Need formula for counting row once when two columns meet criteria

  1. #1
    Registered User
    Join Date
    05-17-2014
    MS-Off Ver
    Excel 2003
    Posts
    45

    Need formula for counting row once when two columns meet criteria

    BP Formula.xlsxI'm not sure what formula to use or if Excel can do this. I want to use it to determine number of blood pressures in a certain range. So if I use column A for SBP (systolic BP) and column B for DBP (diastolic BP). I want a formula to tell me if column A is between 140-159 or column B is between 90-99. I can get that part, but what I'm having trouble with is it counting each row twice if both column A and B meet the criteria, whereas I want every row (person) to only be counted once if either column A OR column B meet the criteria. (See attachment) PLEASE HELP!!
    Last edited by ajeffres; 05-17-2014 at 10:46 PM.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Need Help!

    Hi and welcome to the forum

    Maybe something like this?

    =IF(OR(and(A1>=141,A1<160),and(B1>=90,B1<100)),1,"")

    You could then add up all the 1's
    Last edited by FDibbins; 05-17-2014 at 10:44 PM.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    05-17-2014
    MS-Off Ver
    Excel 2003
    Posts
    45

    Re: Need formula for counting row once when two columns meet criteria

    That works out great, I'll just add in a column for that to add up and then total it! Thank you!

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Need formula for counting row once when two columns meet criteria

    you'r welcome. If this answered your question, please take a moment to mark the thread as "solved" - it helps keep things neat and tidy lol, and consider adding the reputation to those that helped (see points 2 & 3 below my 1st post to you)

  5. #5
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: Need formula for counting row once when two columns meet criteria

    If you don't want to add another column, you may try this Array Formula. Since this is an array formula so you need to confirm it with Ctrl + Shift + Enter instead of just Enter. i.e. after placing the formula in the cell, hold down the Ctrl+Shift and then press Enter.

    Please Login or Register  to view this content.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  6. #6
    Registered User
    Join Date
    05-17-2014
    MS-Off Ver
    Excel 2003
    Posts
    45

    Re: Need formula for counting row once when two columns meet criteria

    Ok, can this be tweaked a little bit for the following...
    I don't want it to count if it falls outside of one of these ranges? For instance if the result would be 160 for column B and 95 for Column C then it shouldn't be counted because it's greater than the range we want for column B.

+ 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