You are here:

- Home
- Computing/Technology
- Business Software
- Excel
- formula syntax

Advertisement

Hi Tom

In worksheet "backup" I have a range A2:D10000. In column A is a list of names. In column D is a list of numbers. There are multiple instances of the same name in column A. For example, "Josie" appears 12 times.

On the same worksheet I have a classlist which appears in range F2:F40. I need to calculate the number that appears most often relative to each student. That figure needs to appear in cells G2:G40.

In cells H2:H40 I would like the second most common number to appear; in cells i2:i40 I would like the third most common number.

Is this something that can be achieved with a formula?

Thanks in advance

Chris

Christopher Mitchell,

You could put this in G2:

=INDEX({1,2,3,4,5,6},MATCH(LARGE(COUNTIFS($A:$A,$F3,$D:$D,{1,2,3,4,5,6,7}),COLUMN(A1)),COUNTIFS($A:$A,$F3,$D:$D,{1,2,3,4,5,6,7}),0))

and drag fill down and then to the right.

However, I have assumed the numbers are between 1 and 7 inclusive and integers.

also this really probably won't work if you have duplicate counts for a student. for example if had

Number count

4 3

7 3

then you would get 4 in column G and 4 in column H. Since I am using Match it won't break ties. To get beyond that, would probably add require quite a bit more work.

I don't know what your limitations are. It can certainly done with a macro. It may also be possible to use some additional columns to get intermediate results.

You can send me a sample file to twogilvy@msn.com and say how you want to proceed.

--

Regards,

Tom Ogilvy

- Add to this Answer
- Ask a Question

Rating(1-10) | Knowledgeability = 10 | Clarity of Response = 10 | Politeness = 10 |

Comment | Thank you Tom. Your response was very thorough and I learned a lot from it. |

This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

Excel

Answers by Expert:

Selected as an Excel MVP by Microsoft since 1999. Answering Excel questions in Allexperts since its inception in 2001. Able to answer questions on almost all aspects of Excel's internal capabilities. If seeking a VBA solution, please specify that in your question itself so I give you the answer you want. [Excel has weak protection - if you are distributing an application, I don't answer questions on how to protect your project from your users.]

Extensive experience. **Education/Credentials**

Master of Science (MS) degree Operations Research (ORSA)**Awards and Honors**

Microsoft MVP in Excel.