Replace INDIRECT(dynamic range) with non-volatile function

AntonyC760

New Member
Joined
Apr 8, 2022
Messages
4
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hello experts,

I have a spreadsheet calculating weekly data based on different criteria. There are 52 rows of this formula and multiple columns for different criteria

The following formula counts # of Tickets Open from “Project1!E2:E79” that fall within the 7 days range
=IF($E$1<$A8,0, COUNTIFS(INDIRECT($B$3),"<"&($A8+1),INDIRECT($B$3),">"&($A8-7)))

A8 is date // eg: 1/1/2022
$B$1 = Project1 //This is the cell user can select project name which corresponds to source data worksheet. eg: Project1, Project2, Project3…etc worksheets in the workbook
$B$2 = COUNTA(INDIRECT($B$1&"!$A:$A")) //count # of rows in column D in Project1 worksheet)
$B$3 = $B$1&"!E2:E"&$B$2 //This creates the range for countifs condition. Eg: Project1!E2:E79 where Column E is Date

$B$3 is a dynamic range depending on the selected project and also source data is updated weekly.
Is there a way to replace INDIRECT($B$3) with a non-volatile function?
The workbook has hundreds of cell which contains similar formula with different matching criteria. And the source data for each project can grow as large as 80,000 rows as the time goes
I am trying to see if there is a way to reduce the calculation time.

The following is an example of the formula I am using
Cell Formulas
RangeFormula
E1E1=TODAY()
B2B2=COUNTA(INDIRECT($B$1&"!$A:$A"))
B3B3=$B$1&"!E2:E"&$B$2
B8:B59B8=IF($E$1<$A8,0, COUNTIFS(INDIRECT($B$3),"<"&($A8+1),INDIRECT($B$3),">"&($A8-7)))
A9:A59A9=A8+7
Cells with Data Validation
CellAllowCriteria
B1ListProject1, Project2, Project3


Project1 worksheet
Ticket #Type1Type2Type3Date
1AAAAAA1/1/22
2AAAAAA1/1/22
3DDDDDD1/1/22
4FFFFFF1/1/22
5RRRRRR1/1/22
6HHHHHH1/6/22
7AAAAAA1/7/22
25AAAAAA1/7/22
26DDDDDD1/7/22
27FFFFFF1/7/22
28RRRRRR1/7/22
29HHHHHH1/7/22
8AAAAAA1/8/22
11AAAAAA1/8/22
12DDDDDD1/8/22
13FFFFFF1/8/22
14RRRRRR1/8/22
9HHHHHH1/9/22
38AAAAAA1/9/22
39AAAAAA1/9/22
40DDDDDD1/9/22
41FFFFFF1/9/22
10RRRRRR1/10/22
15HHHHHH1/15/22
16AAAAAA1/16/22
17AAAAAA1/17/22
18DDDDDD1/18/22
20FFFFFF1/18/22
21RRRRRR1/18/22
22HHHHHH1/18/22
23AAAAAA1/18/22
19AAAAAA1/19/22
24DDDDDD1/24/22
30FFFFFF1/30/22
31RRRRRR1/31/22
32HHHHHH2/1/22
33AAAAAA2/2/22
34AAAAAA2/3/22
35DDDDDD2/4/22
36FFFFFF2/5/22
37RRRRRR2/6/22
42HHHHHH2/11/22
43AAAAAA2/12/22
45AAAAAA2/12/22
46DDDDDD2/12/22
47FFFFFF2/12/22
48RRRRRR2/12/22
49HHHHHH2/12/22
44AAAAAA2/13/22
50AAAAAA2/19/22
51DDDDDD2/20/22
52FFFFFF2/21/22
53RRRRRR2/22/22
54HHHHHH2/23/22
57AAAAAA2/26/22
58AAAAAA2/27/22
59DDDDDD2/28/22
55FFFFFF3/1/22
56RRRRRR3/1/22
60HHHHHH3/1/22
61AAAAAA3/2/22
62AAAAAA3/3/22
64DDDDDD3/3/22
65FFFFFF3/3/22
66RRRRRR3/3/22
67HHHHHH3/3/22
63AAAAAA3/4/22
70AAAAAA3/11/22
68DDDDDD3/12/22
69FFFFFF3/12/22
71RRRRRR3/12/22
74HHHHHH3/12/22
75AAAAAA3/12/22
76AAAAAA3/12/22
77DDDDDD3/12/22
78FFFFFF3/12/22
72RRRRRR3/13/22
73HHHHHH3/14/22
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Hi & welcome to MrExcel.
How many projects are you likely to have?
 
Upvote 0
Hi & welcome to MrExcel.
How many projects are you likely to have?
Hello Fluff,

I will have 3 projects from 3 different years.
Eg:
Project1 (from 2022)
Project2 (from 2021)
Project3 (from 2020)

Thank you!
 
Upvote 0
In that case you can use
Excel Formula:
=LET(Rng,SWITCH($B$1,"project1",Project1!E:E,"Project2",Project2!E:E,"Project3",Project3!E:E),IF($E$1<$A8,0, COUNTIFS(Rng,"<"&($A8+1),Rng,">"&($A8-7))))
 
Upvote 0
Solution
Thank you Fluff for the feedback! The formula works.
I will create 3 separate Summary worksheet to calculate data for each of the project. This way I can make a comparison chart on these projects
eg: Summary1 (calculate Project1 data), Summary2 (calculate Project2 data), Summary3 (calculate Project3 data).

I will also allow user to change the Project name as needed. (Project1, Project2, Project3 worksheet names will also be changed accordingly)

Is there a way to make the Project1!E:E in the formula below a dynamic variable?
=LET(Rng,Project1!E:E,IF($E$1<$A8,0, COUNTIFS(Rng,"<"&($A8+1),Rng,">"&($A8-7))))

I tried the following, excel returns #VALUE!
=LET(Rng,$B$1&"!E:E",IF($E$1<$A8,0, COUNTIFS(Rng,"<"&($A8+1),Rng,">"&($A8-7))))

The following formula returns 0 on all calculation
=LET(Rng,$B$3,IF($E$1<$A8,0, COUNTIFS(Rng,"<"&($A8+1),Rng,">"&($A8-7))))

RangeFormula
Cell Formulas
E1E1=TODAY()
B2B2=COUNTA(INDIRECT($B$1&"!$A:$A"))
B3B3=$B$1&"!E2:E"&$B$2

Thank you!
 
Upvote 0
You can either do it the way I showed, or by using indirect.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,327
Members
452,635
Latest member
laura12345

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