Using a defined range within an index formula

Blunder1

Active Member
Joined
Jun 2, 2010
Messages
250
Hi,

In my code i need to count the mose frequent names in a list. If i set the range as 'rng' for teh column how do i use this in the formule?

This is what i have as an using FormulaArray:-

<TABLE style="WIDTH: 181pt; BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=0 width=241 border=0 x:str><COLGROUP><COL style="WIDTH: 181pt; mso-width-source: userset; mso-width-alt: 8813" width=241><TBODY><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-RIGHT: #d4d0c8; BORDER-TOP: #d4d0c8; BORDER-LEFT: #d4d0c8; WIDTH: 181pt; BORDER-BOTTOM: #d4d0c8; HEIGHT: 12.75pt; BACKGROUND-COLOR: transparent" width=241 height=17 x:str="'=INDEX(Stats!H1:H847,MATCH(MAX(COUNTIF(Stats!H2:H618,Stats!H2:H618)),COUNTIF(Stats!H2:H618,Stats!H2:H618),0))">
Code:
=INDEX(Stats!H1:H847,MATCH(MAX(COUNTIF(Stats!H2:H618,Stats!H2:H618)),COUNTIF(Stats!H2:H618,Stats!H2:H618),0))


What i would like is:-

Code:
=index(rng,match(max(countif(rng,rng)),countif(rng,rng),0))

</TD></TR></TBODY></TABLE>
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
It's not clear to me what your actual problem is? Have you named the range?
 
Upvote 0
And what is the problem you are having when you do that?
 
Upvote 0
the cell in the worksheet is populated with rng and does not know what this is. I think the formula needs to be worked out within the vba code, such as using 'worksheetfunction'?
 
Upvote 0
You haven't mentioned VBA at all up until now - I assumed you had named the range 'rng' in which case the formula would work as is.
 
Upvote 0
Well, your question doesn't really make sense now, so I'd have to guess you mean something like:
Code:
dim strAddy as String
strAddy = rng.address
Activecell.formula = "=index(" & straddy & ",match(max(countif(" & straddy & "," & straddy & ")),countif(" & straddy & "," & straddy & "),0))"
 
Upvote 0
Not to worry - at least we got there in the end. :)
 
Upvote 0

Forum statistics

Threads
1,224,561
Messages
6,179,521
Members
452,923
Latest member
JackiG

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