How to count the number of numbers in a given period?

JenniferMurphy

Well-known Member
Joined
Jul 23, 2011
Messages
2,691
Office Version
  1. 365
Platform
  1. Windows
I have a spreadsheet for recording various medical metrics requested by my doctor (blood pressure, weight, etc). I have expressions for calculating the max (using MaxIfs), min (using MinIfs), and average (using AverageIfs) of a period of time. But I am having trouble coming up an expression for the number of readings. I tried to use CountIfs, but could not come up with an expression for the criteria. I also tried SumProduct as in the mini-sheet below, but that is also not working.

I would appreciate any help.

Book1
BCD
4
5DateSystolic
68/20/24102
78/27/24
88/30/2497
99/15/24113
109/22/24
119/30/24114
1210/05/24
1310/15/24
1410/20/2498
15Number of days30
16First day09/20/24
17Number of readings0
18Maximum114
19Average106
20Minimum98
Sheet1
Cell Formulas
RangeFormula
C16C16=TODAY()-NumDays
D17D17=SUMPRODUCT((Table1[Date]>=(TODAY()-NumDays)), ISNUMBER(Table1[Systolic]))
D18D18=MAXIFS(Table1[Systolic],Table1[Date],">=" & FirstDay)
D19D19=AVERAGEIFS(Table1[Systolic],Table1[Date],">=" & FirstDay)
D20D20=MINIFS(Table1[Systolic],Table1[Date],">=" & FirstDay)
Named Ranges
NameRefers ToCells
FirstDay=Sheet1!$C$16D18:D20
NumDays=Sheet1!$C$15D17, C16
 
Oops my bad I didn't pick up on the date criteria.
I figured blood pressure wouldn't go over 300 but any number seems to force it to only pick up numbers.
I thought when I tried >0 it didn't work but that was my mistake and that works as well.
No problem. If we go back and count the number of times you messed up and the number of times I did, I am winning in a landslide. And I won't even claim that the election was stolen. Thanks for all your help on so many questions.
 
Upvote 0

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Not using Countifs.
That needs you to do something to the range parameter which converts it to an array and the CountIfs group of functions only allow a "Range" for that parameter.

=countifs( criteria_range, criteria,...)
 
Upvote 0
Not using Countifs.
That needs you to do something to the range parameter which converts it to an array and the CountIfs group of functions only allow a "Range" for that parameter.

=countifs( criteria_range, criteria,...)
Yeah, I tried =COUNTIFS(Table1[Date],">="&FirstDay,Table1[Systolic],ISNUMBER(Table1[Systolic]) but it returned an array.
 
Upvote 0
If my data could be any number, is there an expression that will work for that?
You could test that the number is smaller than the biggest number you can have in Excel - i.e.

Excel Formula:
=COUNTIFS(Table1[Date],">="&FirstDay,Table1[Systolic],"<=9.99999999999999E+307")
 
Upvote 0
You could test that the number is smaller than the biggest number you can have in Excel - i.e.

Excel Formula:
=COUNTIFS(Table1[Date],">="&FirstDay,Table1[Systolic],"<=9.99999999999999E+307")
Clever
 
Upvote 0
Hi, assuming it can never be zero or less than zero, you could also try:
Excel Formula:
=COUNTIFS(Table1[Date],">="&FirstDay,Table1[Systolic],">0")
I am changing the answer to this thread to this solution. I wanted to use CountIfs because it clearly (for me) showed the two criteria. The SumProduct solution is less obvious to me.

Sanjeev, thanks for your help. I will keep that solution in mind, too.
 
Upvote 0

Forum statistics

Threads
1,224,889
Messages
6,181,608
Members
453,055
Latest member
cope7895

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top