Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 247
Default MODE - Second most frequent value

Hi All,

I would like to find the second (2nd) most frequent value in a filtered
single column, using a dynamic named range called "Data". Only the visible
cells should be used in the calculation. Can this be done using the named
range in a single Formula and the result returned to a single cell?

Thanks
Sam

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...tions/200807/1

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,231
Default MODE - Second most frequent value

"Sam via OfficeKB.com" <u4102@uwe wrote...
I would like to find the second (2nd) most frequent value in a
filtered single column, using a dynamic named range called "Data".
Only the visible cells should be used in the calculation. Can this
be done using the named range in a single Formula and the result
returned to a single cell?

....

If the range named Data were filtered, then its mode would be given by
the array formula

=MODE(IF(SUBTOTAL(2,OFFSET(Data,ROW(Data)-MIN(ROW(Data)),0,1,1)),
SUBTOTAL(9,OFFSET(Data,ROW(Data)-MIN(ROW(Data)),0,1,1))))

If this were entered in cell X99, then the next most frequently
occurring value would be given by the array formula

=MODE(IF(SUBTOTAL(2,OFFSET(Data,ROW(Data)-MIN(ROW(Data)),0,1,1))
*(SUBTOTAL(9,OFFSET(Data,ROW(Data)-MIN(ROW(Data)),0,1,1))<X99),
SUBTOTAL(9,OFFSET(Data,ROW(Data)-MIN(ROW(Data)),0,1,1))))

While this *can* be done, it's a bad idea to do it. These formulas
require volatile function calls and do a LOT of work. It'd be better
to use a criteria range and incorporate the criteria into your
formula. For example, if you wanted all records for which the ID field
was THIS, the mode would be given by

=MODE(IF(ID="THIS",Data))

and the second most frequently occurring value in Data by

=MODE(IF((DI="THIS")*(Data<X99),Data))

where X99 is assumed again to hold the first MODE formula. These don't
call volatile functions, and they do only what's needed to return the
answer.
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 247
Default MODE - Second most frequent value

Hi Harlan,

Thank you very much for reply and assistance. I appreciate you taking the
time to provide a solution to my request but also highlighting the pitfalls
of using such formulas; providing an alternative formula with less overhead
is much appreciated.

Cheers,
Sam


Harlan Grove wrote:
"Sam via OfficeKB.com" <u4102@uwe wrote...
I would like to find the second (2nd) most frequent value in a
filtered single column, using a dynamic named range called "Data".
Only the visible cells should be used in the calculation. Can this
be done using the named range in a single Formula and the result
returned to a single cell?

...


If the range named Data were filtered, then its mode would be given by
the array formula


=MODE(IF(SUBTOTAL(2,OFFSET(Data,ROW(Data)-MIN(ROW(Data)),0,1,1)),
SUBTOTAL(9,OFFSET(Data,ROW(Data)-MIN(ROW(Data)),0,1,1))))


If this were entered in cell X99, then the next most frequently
occurring value would be given by the array formula


=MODE(IF(SUBTOTAL(2,OFFSET(Data,ROW(Data)-MIN(ROW(Data)),0,1,1))
*(SUBTOTAL(9,OFFSET(Data,ROW(Data)-MIN(ROW(Data)),0,1,1))<X99),
SUBTOTAL(9,OFFSET(Data,ROW(Data)-MIN(ROW(Data)),0,1,1))))


While this *can* be done, it's a bad idea to do it. These formulas
require volatile function calls and do a LOT of work. It'd be better
to use a criteria range and incorporate the criteria into your
formula. For example, if you wanted all records for which the ID field
was THIS, the mode would be given by


=MODE(IF(ID="THIS",Data))


and the second most frequently occurring value in Data by


=MODE(IF((DI="THIS")*(Data<X99),Data))


where X99 is assumed again to hold the first MODE formula. These don't
call volatile functions, and they do only what's needed to return the
answer.


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...tions/200807/1

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding the least frequent value in an array Dave D[_2_] Excel Discussion (Misc queries) 3 May 5th 07 12:56 PM
Find the most frequent date MarkN Excel Worksheet Functions 3 June 26th 06 01:15 AM
Using Mode in Excel, need more than 1st most frequent number. waterdancn Excel Worksheet Functions 2 April 12th 06 11:36 PM
Combo Box goes to edit mode even if design mode is in OFF position Chas Excel Discussion (Misc queries) 0 January 7th 05 07:21 PM
coverting answer from Radian mode to degree mode Xmastrzman Excel Worksheet Functions 1 November 10th 04 04:45 PM


All times are GMT +1. The time now is 10:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"