Salesforce and other SMB Solutions are coming soon. ×

# Mode

## Recommended Posts

I'm looking for a script or algoritm which generates the mode for a group of numbers (each from its own record).

##### Share on other sites

What do you mean by "each from its own record"?

##### Share on other sites

Are we doing homework here?

The MODE is simply the number(s) that occur(s) most often within a group of numbers. This is a general math topic of course.

You could obviously construct a brute-force approach to count the numbers and select the most frequent.

A more elegant approach might be to use a combination of summary fields and calc fields to isolate the most frequent number.

##### Share on other sites

It's not that easy, but before we get into it, could we have some more details, please? Like what do you want to return in case of bimodal/multimodal set?

##### Share on other sites

I am summarizing test scores. Each test has nine questions. Each question has a result of 0 to 4. I am currently able to report the avegare score for each question but I want to report the mode for each question.

Each students scores comprise one record. In a table the data would look like "student name" "Question 1 score" "question 2 score" etc.

In a trailing summary I can disply the average score for each question. I want to display the mode as well.

##### Share on other sites

I am afraid you did not answer my question. Let's say there are 7 students and their respective scores for Question 1 are: 0, 0, 1, 1, 2, 4, 4.

Note that 0, 1 and 4 have the same frequency.

What is the value you want to display as mode in such case?

##### Share on other sites

Your questions have helped me out! I think I'll have to report the frequency of each of the five possible responses. I can script a find and count each of the responses.

Thanks

#### Archived

This topic is now archived and is closed to further replies.

• ### Images

• By Soliant Consulting,
• By Soliant Consulting,
• By Soliant Consulting,
• ### Forum Statistics

• Total Topics
33.7k
• Total Posts
141.5k
×
×
• Create New...