Subtotal that excludes duplicates

MrsFraser07

New Member
Joined
Aug 16, 2017
Messages
44
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hi there,

I came up with the following formula (thanks to alot of Googling!):

{=SUM(IF(FREQUENCY(IF(SUBTOTAL(3,OFFSET($H$4,ROW(H4:H1048576)-ROW($H$4),,1)),IF(H4:H1048576<>"",MATCH("~"&H4:H1048576,H4:H1048576&"",0))),ROW(H4:H1048576)-ROW(H4)+1),1))}

It works, but it is very slow. The data in column H is text. I will be filtering in a different column in my spreadsheet and I want a total of all unique values in column H. Wondering if there is a more efficient way to do this? To help speed things up? I realize it might help if I didn't have all the way to H1048576, I just do this out of habit so I don't have to change my formulas if I add more rows.

Many thanks!
Shari
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Oh wow!!! I just tried it, reduced my formula to H10000 and it is way faster! Didn't think it would make that big of a difference. Thanks!

Just curious though.....I don't even know what some of this formula means and I would like to learn.

What is the MATCH("~"&H4:H1048576,H4:H1048576&"",0)) part saying?
 
Upvote 0
No idea, best to ask whoever you got it from.

Typically "~" is used to identify "*" or "?" as actual characters instead of wildcards, beyond that I don't think it has any purpose.
 
Upvote 0

Forum statistics

Threads
1,215,450
Messages
6,124,912
Members
449,195
Latest member
Stevenciu

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