How do I use a cell reference instead of a number in a countifs

Jacksioni

New Member
Joined
Feb 25, 2025
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi,
Trying to automate a report as much as I can, and the data is all in excel. Currently drawing the number of incidents, etc from another sheet using =COUNTIFS('2025'!$AO6:$AO2000,"7")
All these are automatically turned into graphs etc for use. It all works fine when I am in the office but just want someone to be able to switch one number and it updates automatically.

Is it possible to substitute the 7 in the formula for any number put into J2, so that when J2 is changed to say 8, it the formula will then populate the incident number with week 8's total incidents.

1740532426021.png


Cheers

Jackson
 
Welcome to the MrExcel forum!

Try:

Excel Formula:
=COUNTIFS('2025'!$AO6:$AO2000,J2)
for equal, or

Excel Formula:
=COUNTIFS('2025'!$AO6:$AO2000,">="&J2)
for greater than or equal.
 
Upvote 0
In addition to Eric's comments, be careful with "7" (text value) vs 7 (numeric value) as they are not the same.

COUNTIF() and COUNTIFS() ignore the difference, as shown below. But there are plenty of other functions where the difference matters and you won't get the results you're expecting.

AB
1Text2
2Numeric2
3
4TextNumeric
577
6TRUEFALSE
7FALSETRUE
Sheet1
Cell Formulas
RangeFormula
B1B1=COUNTIF(A5:B5,7)
B2B2=COUNTIF(A5:B5,"7")
A6:B6A6=A5="7"
A7:B7A7=A5=7
 
Upvote 0

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