Sum If

Tikey

Board Regular
Joined
Jan 30, 2014
Messages
148
Office Version
  1. 2021
Platform
  1. Windows
I am using Excel 2016 ( not 365 ) and have a good spec i7 CPU computer.

I have a large spreadsheet containing 250000 rows and growing. Within the sheet one column contains dates in the format 01/01/2018 and another an alpha numerical value in the form AA1234. I am counting the number of unique occurrences of the alpha / number within a certain year. I am currently using the following formula’s to do this, the first for a single year and the second for a range of years.

=SUM(IF(FREQUENCY(IF(YEAR(Records!$F$2:$F$40000)=1992,IF(Records!$T$2:$T$40000<>"",MATCH("~"&Records!$T$2:$T$40000,Records!$T$2:$T$40000&"",0))),ROW(Records!$T$2:$T$40000)-ROW(Records!T$2)+1),1))

=SUM(IF(FREQUENCY(IF(YEAR(Records!$F$2:$F$40000)>=1992,IF(YEAR(Records!$F$2:$F$40000)<=1993,IF(Records!$T$2:$T$40000<>"",MATCH("~"&Records!$T$2:$T$40000,Records!$T$2:$T$40000&"",0)))),ROW(Records!$T$2:$T$40000)-ROW(Records!T$2)+1),1))

Both are entered using CTRL, SHIFT, ENTER.

The problem I am having is that doing this calculation takes several minutes for every occurrence of it and when updating the data and redoing the calcs it has become almost unworkable. You will note in the formula I have restricted it to 40000 rows. Can anyone provide a suggestion as to how to do this more efficiently which will allow Excel to work at a more workable speed, I have thought of a Pivot Table but not sure if this is do able.

Any help appreciated.
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
From post 13, do I gather you don't think 45 secs is a long time for this, maybe I am expecting too much ?
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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