Find most frequently occurring text string in a VISIBLE or filtered

xdenama

New Member
Joined
Feb 12, 2016
Messages
39
Office Version
  1. 365
How to find most frequently occurring text string in a VISIBLE or after filtered apply.
 

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.
To return the most frequently occurring text value in visible or filtered rows, let's say B2:B10, try the following array formula that needs to confirmed with CONTROL+SHIFT+ENTER.. Change the range references accordingly.

VBA Code:
=INDEX(B2:B10,MODE(IF(SUBTOTAL(3,OFFSET(B2:B10,ROW(B2:B10)-ROW(B2),0,1))>0,MATCH(B2:B10,B2:B10,0))))

Also, to include in the calculations rows that have also been manually hidden, as apposed to filtered, change the number 3 in SUBTOTAL to 103.

Unfiltered Data

NameCategory
AZ
BY
CY
AX
AX
BY
CY
BY
AX

The formula returns Y.

Filtered Data (filtered for A)

NameCategory
AZ
AX
AX
AX

Formula returns X.

Hope this helps!
 
Upvote 0
To return the most frequently occurring text value in visible or filtered rows, let's say B2:B10, try the following array formula that needs to confirmed with CONTROL+SHIFT+ENTER.. Change the range references accordingly.

VBA Code:
=INDEX(B2:B10,MODE(IF(SUBTOTAL(3,OFFSET(B2:B10,ROW(B2:B10)-ROW(B2),0,1))>0,MATCH(B2:B10,B2:B10,0))))

Also, to include in the calculations rows that have also been manually hidden, as apposed to filtered, change the number 3 in SUBTOTAL to 103.

Unfiltered Data

NameCategory
AZ
BY
CY
AX
AX
BY
CY
BY
AX

The formula returns Y.

Filtered Data (filtered for A)

NameCategory
AZ
AX
AX
AX

Formula returns X.

Hope this helps!

Very appreciate... It's work, thank you so much :)
 
Upvote 0

Forum statistics

Threads
1,224,815
Messages
6,181,136
Members
453,021
Latest member
Justyna P

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