Getting occurrence within an excel column even when the column is filtered


We use this formula to get the occurrence of items within a column ("=SUM(IF(FREQUENCY(MATCH(B10:B64781,B10:B64781,0),MATCH(B10:B64781,B10:B64781,0))>0,1))").  However, we need to place filters in the columns and want to reflect the occurrence as the items being filtered.  We took a look at "=SUBTOTAL" but can't get it work as we want it.

Is there a way to this?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
Please give this a try...
=SUM(IF(FREQUENCY(IF(SUBTOTAL(3,OFFSET(B10,ROW(B10:B64781)-ROW(B10),,1)), IF(B10:B64781<>"",MATCH("~"&B10:B64781,B10:B64781&"",0))),ROW(B10:B64781)-ROW(B10)+1),1))

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rayluvsAuthor Commented:
Gave me a "Circular Reference Warning".

I have included an excel with a small data.  I placed the formula I usually use without filter = the result is 8 unique register (but since I can't set filter, it stays 8).
Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
You were getting the circular reference warning because you placed the formula cell (B4) itself in the formula.

Please refer to the attached.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

rayluvsAuthor Commented:
Thanx worked!

However, when I copied the formula over to my working excel (the same cell B4) but says says "#VALUE!".  Noticed in your excel that the formula is in brackets but when I go into it,the brackets disappear - do i  have to do something to activate the formula?
rayluvsAuthor Commented:
Ok, I had to ctrl-shift.

Ok thanx
Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
That's right. Since it is an Array Formula, you need to confirm it with Ctrl+Shift+Enter instead of Enter alone.
rayluvsAuthor Commented:
Thank you very much!

May I bother you for a bit of explanation of the formula?

Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
In SUBTOTAL(3, 3 is for COUNTA so the Subtotal formula is finding the visible cells with some content in them and so the Frequency output is filtered based on the Subtotal criteria as well and in the end you get the unique count from the visible cells.
rayluvsAuthor Commented:
Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
You're welcome!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.