Need "SUMPRODUCT, COUNTIF" non-volatile formula to filter data by year

motilulla

Well-known Member
Joined
Feb 13, 2008
Messages
2,362
Office Version
  1. 2010
Hello,

In the column "C" I got year and in the column "D" the numbers "0 to 6"
In the cells G4:M4 numbers "0 to 6"
And in the cells G5:M5 got the formula below

VBA Code:
G5 = SUMPRODUCT(SUBTOTAL(3,OFFSET($D$6,ROW($D$6:$D$53)-ROW($D$6),0,1)),--($D$6:$D$53=G4))

And copied across till M5

The above "SUMPRODUCT, COUNTIF" formula is working fine when I filter the year but...
Please I need this formula can be converted a non-volatile formula?

Example image is attached for more details

*ABCDEFGHIJKLM
1
2
3
4YearNumbersNumbers0123456
5YearNumbersCountif171516432
620080
720101
820071
920101
1020092
1120092
1220081
1320062
1420062
1520101
1620062
1720055
1820102
1920053
2020053
2120052
2220103
2320053
2420071
2520102
2620062
2720092
2820066
2920083
3020072
3120093
3220063
3320091
3420082
3520065
3620092
3720063
3820053
3920062
4020083
4120093
4220082
4320063
4420103
4520106
4620064
4720104
4820103
4920084
5020104
5120085
5220093
5320053
54
55
56

Thank you all.

I am using Excel 2000

Regards,
Moti
 

Attachments

  • Countif Year Filter Data.png
    Countif Year Filter Data.png
    39.4 KB · Views: 9

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Why you don't Use:
Excel Formula:
= SUMPRODUCT(CountA(OFFSET($D$6,ROW($D$6:$D$53)-ROW($D$6),0,1)),--($D$6:$D$53=G4))
 
Upvote 0
You could use a helper column
+Fluff 1.xlsm
CDEFGHIJKLM
4YearNumbersNumbers0123456
5YearNumbersCountif171516432
6200801
7201011
8200711
9201011
10200921
11200921
12200811
13200621
14200621
15201011
16200621
17200551
18201021
19200531
20200531
21200521
22201031
23200531
24200711
25201021
26200621
27200921
28200661
29200831
30200721
31200931
32200631
33200911
34200821
35200651
36200921
37200631
38200531
39200621
40200831
41200931
42200821
43200631
44201031
45201061
46200641
47201041
48201031
49200841
50201041
51200851
52200931
53200531
Data
Cell Formulas
RangeFormula
G5:M5G5=SUMPRODUCT(--($E$6:$E$53=1),--($D$6:$D$53=G4))
E6:E53E6=SUBTOTAL(3,D6)
 
Upvote 0
Solution
Why you don't Use:
Excel Formula:
= SUMPRODUCT(CountA(OFFSET($D$6,ROW($D$6:$D$53)-ROW($D$6),0,1)),--($D$6:$D$53=G4))
maabadi, I applied formula but getting an error #VALUE!, function "OFFSET" is volatile I am looking formula to be replaced non-volatile

Please check, thank you for your help

Kind Regards,
Moti
 
Upvote 0
You could use a helper column
+Fluff 1.xlsm
CDEFGHIJKLM
4YearNumbersNumbers0123456
5YearNumbersCountif171516432
6200801
7201011
8200711
9201011
10200921
11200921
12200811
13200621
14200621
15201011
16200621
17200551
18201021
19200531
20200531
21200521
22201031
23200531
24200711
25201021
26200621
27200921
28200661
29200831
30200721
31200931
32200631
33200911
34200821
35200651
36200921
37200631
38200531
39200621
40200831
41200931
42200821
43200631
44201031
45201061
46200641
47201041
48201031
49200841
50201041
51200851
52200931
53200531
Data
Cell Formulas
RangeFormula
G5:M5G5=SUMPRODUCT(--($E$6:$E$53=1),--($D$6:$D$53=G4))
E6:E53E6=SUBTOTAL(3,D6)
Fluff, interesting formula, yes it worked perfect, and off course it is non-volatile as I request.

Just a question does it could be other option which work without the helper column if not I will use this

Thank you so much for your help

Kind Regards,
Moti :)
 
Upvote 0
As far as I know, you either need the helper column, or the Offset function.
 
Upvote 0
As far as I know, you either need the helper column, or the Offset function.
Fluff, thank you for the answer, let wait till tomorrow may someone has solution without helper column

Kind Regards,
Moti
Thank you very much Fluff, after you gave a solution nearly 28 views has been more it seems that there is only one ways as you describe to fix it non-volatile has to be with helper column, yes I adapted the formula in various situations and really it is working like magic absolutely perfect - you are a star I can say it is solved. (y)

Have a nice day and Good Luck

Kind Regards,
Moti :)
 
Upvote 0

Forum statistics

Threads
1,214,787
Messages
6,121,565
Members
449,038
Latest member
Guest1337

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