Subgroup and list top 2

Danny54

Active Member
Joined
Jul 3, 2019
Messages
295
Office Version
  1. 365
Platform
  1. Windows
How can I go about creating a subgroup listing of the top 2

The data

Name
a
a
b
b
b
c
c
d
d
d
d


output to starting range("G15")

Top 2
D = 4
B = 3


Even the simple stuff sometimes seams difficult
 
Sorta moving forward a bit,


I've added the following to my VBA module.

Range("G15").Value = "Top 5"

Range("G16").FormulaArray = "=IFERROR(INDEX($A$2:$A$83,MODE(IFERROR(MATCH($A$2:$A$83,$A$2:$A$83,0)*{1,1}/(COUNTIF($G$15:$G15,$A$2:$A$183)=0),""))),"")"

Range("H16").Formula = "=COUNTIF($A$2:$A$83,G16)"


I receive the following Error

Run-Time error '1004'
Application-defined or object-defined error


Can I not insert the FormulaArray = statement and have it automatically executed?

Thanks
 
Upvote 0

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
My first guess is the use of quotes within quotes. When using quotes within quotes, you have to double them so that the compiler recognizes them as interior to the string, and not a terminator of the string. If there are doubled quotes, which happens twice, you have to double each one. So the line should be:

Code:
[COLOR=#333333]Range("G16").FormulaArray = "=IFERROR(INDEX($A$2:$A$83,MODE(IFERROR(MATCH($A$2:$A$83,$A$2:$A$83,0)*{1,1}/(COUNTIF($G$15:$G15,$A$2:$A$183)=0),[/COLOR][COLOR=#ff0000]""""[/COLOR][COLOR=#333333]))),[/COLOR][COLOR=#ff0000]""""[/COLOR][COLOR=#333333])"[/COLOR]
 
Upvote 0
Solution

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