Countif using a variable range

itsrich

New Member
Joined
Apr 13, 2009
Messages
49
Office Version
  1. 2019
Platform
  1. Windows
=COUNTIF('[2022.10.14 FAB Tracking & Reporting Sheet.xlsx]Time Tracking'!$C$262:$C$701,A3)

I am attempting to make Countif change the range $C$262:$C$701 with the values in B1 & D1

The data referenced is only a sample of all the data. I am hoping I can change two cells and change the reference.

If I could write this formula as simple as possible
=COUNTIF('[2022.10.14 FAB Tracking & Reporting Sheet.xlsx]Time Tracking'!$C$B1:$C$D1,A3)

I am planning on using this in other formulas on the spreadsheet... I figure with an example, I can figure out the others.

=SUMIF('[2022.10.14 FAB Tracking & Reporting Sheet.xlsx]Time Tracking'!$C$262:$C$701,A3,'[2022.10.14 FAB Tracking & Reporting Sheet.xlsx]Time Tracking'!$S$262:$S$701)/B3

=COUNTIFS('[2022.10.14 FAB Tracking & Reporting Sheet.xlsx]Time Tracking'!$C262:$C701,A3)

TY in advance!

Book11
ABCD
1Start Cell262End Cell701
2ModelCount
3BATX1656
Sheet1
Cell Formulas
RangeFormula
B3B3=COUNTIF('[2022.10.14 FAB Tracking & Reporting Sheet.xlsx]Time Tracking'!$C$262:$C$701,A3)
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
I'd do it like this... I hope you can use a similar in other places on your spreadsheet.
MrExcelPlayground13.xlsx
CDE
1Look for:Silly
2First Row7
3Last Row20
4
5Silly3
6Goose
7Silly
8Fred
9Harry
10Goose
11Fred
12Harry
13Silly
14Silly
15Goose
16Fred
17Goose
18Harry
19Goose
20Fred
Sheet5
Cell Formulas
RangeFormula
E5E5=SUMPRODUCT(--(C5:C20=E1),--(ROW(C5:C20)>=E2),--(ROW(C5:C20)<=E3))
 
Upvote 0
Another way would be
Excel Formula:
=COUNTIF(INDEX('[2022.10.14 FAB Tracking & Reporting Sheet.xlsx]Time Tracking'!$C:$C,B1):INDEX('[2022.10.14 FAB Tracking & Reporting Sheet.xlsx]Time Tracking'!$C:$C,D1),A3)
 
Upvote 0
TY Fluff!

I moved the TAB to the Spreadsheet, so the formula was less confusing. Long file names are difficult to work in formulas.

Using the same INDEX formula in SUMIF of C4:C9 results in 0. C3 has the original formula.

This does not work:
Excel Formula:
=SUMIF(INDEX('Time Tracking'!$C:$C,$B$1):INDEX('Time Tracking'!$C:$C,$D$1),A5,INDEX('Time Tracking'!$C:$C,$B$1):INDEX('Time Tracking'!$C:$C,$D$1))/B5

This does work: SUMIF does not like the INDEX functions in the third argument. The 7107 in C3 is correct, the data needs to be reviewed. I am expecting double-digit numbers. Getting the formulas correct first!
Excel Formula:
=SUMIF(INDEX('Time Tracking'!$C:$C,$B$1):INDEX('Time Tracking'!$C:$C,$D$1),A4,'Time Tracking'!$S$262:$S$701)/B4

Again, ty for your knowledge ahead of time.

2022.10.14 FAB Tracking & Reporting Sheet.xlsx
ABCD
1Start Cell262End Cell701
2ModelCountAverage Days in
3BATX165620
4BATX175CR127107
5BATX175PRO100
6BATX195CR10
7BATX195PRO30
8BAY190CC50
9BAY210CC130
Time Report
Cell Formulas
RangeFormula
B3:B9B3=COUNTIF(INDEX('Time Tracking'!$C:$C,$B$1):INDEX('Time Tracking'!$C:$C,$D$1),A3)
C3C3=SUMIF('Time Tracking'!$C$262:$C$701,A3,'Time Tracking'!$S$262:$S$701)/B3
C4C4=SUMIF(INDEX('Time Tracking'!$C:$C,$B$1):INDEX('Time Tracking'!$C:$C,$D$1),A4,'Time Tracking'!$S$262:$S$701)/B4
C5:C9C5=SUMIF(INDEX('Time Tracking'!$C:$C,$B$1):INDEX('Time Tracking'!$C:$C,$D$1),A5,INDEX('Time Tracking'!$C:$C,$B$1):INDEX('Time Tracking'!$C:$C,$D$1))/B5
 
Last edited:
Upvote 0
The 2nd part of that formula should be looking at col S not col C
 
Upvote 0
Solution
The 2nd part of that formula should be looking at col S not col C
GRRRR These are the type of errors that drive you up a wall, TY again Fluffy!

Again, TY for the help. This will give me the direction I need to keep me busy for a while. Now to clean up the data and turn the report into the GM.
 
Last edited:
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,734
Messages
6,126,542
Members
449,316
Latest member
sravya

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