# Tags: LARGE

Assume a database in range D5:D11 with the following values - Black, Black, Purple, Purple, Grey, Grey, Grey.  To extract the most frequently occurring item, one may use the following formula

=INDEX(\$D\$5:\$D\$11,MODE(MATCH(\$D\$5:\$D\$11,\$D\$5:\$D\$11,0)))

To extract the second most frequently occurring item, try the following:

1. Enter 2 in cell C16:
2. In cell D16, enter the following array formula (Ctrl+Shift+Enter)

=LOOKUP(2,1/(LARGE(FREQUENCY(IF(INDEX(COUNTIF(\$D\$5:\$D\$10,\$D\$5:\$D\$10),0),MATCH(\$D\$5:\$D\$10,\$D\$5:\$D\$10,0)),ROW(\$D\$5:\$D\$10)-ROW(\$D\$4))+(ROW(\$D\$5:\$D\$11)/10000),C16)=FREQUENCY(IF(INDEX(COUNTIF(\$D\$5:\$D\$10,\$D\$5:\$D\$10),0),MATCH(\$D\$5:\$D\$10,\$D\$5:\$D\$10,0)),ROW(\$D\$5:\$D\$10)-ROW(\$D\$4))+(ROW(\$D\$5:\$D\$11)/10000)),\$D\$5:\$D\$10)

To extract the n th most frequently occurring item, enter that n th number in cell C16.

Given a list of names in a worksheet range, one may want to pull out, the most frequently appearing names in descending order of frequency, to another range.  Furthermore, one may want to provide an additional date criteria as well.

You may refer to my solution in this workbook.

Assume a two column database with names in column A and numbers in column B.  Names in column A may be repeated.  If a user types a certain name in a cell, a formula should sum the highest three values from column B for that name.

Depending upon the version of MS Excel which you are using, there could be two ways to solve this problem

Solution for MS Excel 2010 and higher versions

If you are using the PowerPivot add-in, then a simple DAX formula can solve this problem.

Solution for all versions of MS Excel

While this solution works for all versions of MS Excel, it uses an array formula (Ctrl+Shift+Enter).  Array formulas, if used extensively in the workbook, adversely effect the system's performance.

You may refer to my solution in this workbook.

In range A2:A6, the numbers are 7.5, 2, -12, 11.2 and 8.  In cell B8, a user enters 8.  One may want to answer the following questions:

1. Return the closest number which is less than or equal to the number in cell B8
2. Return the closest number which is greater than or equal to the number in cell B8
3. Return the closest match

You may refer to my solution in this workbook.