### Title

Median and mode for a set of records?

### Post

I have a survey database with Person table. Each person has an age (calculated from DOB in whole years). I want to find a set of records and determine the modal and median age. Does FileMaker have these functions? I haven't been able to find them.

Thanks for your help.

No, but you can script for them.

Go To Record [Ceiling ( Get ( FoundCount ) / 2 ) ]

will land you on the median after you've sorted them in increasing order by age. (and you can script to find the midpoint of the two center values if you have an even number of records if you need that level of precision.)

Mode is a bit trickier:

You can define a "count of" summary field to count the number of records with each age group by using a calculation field that uses:

GetSummary ( sCountSummaryField ; AgeField )

Then it's a matter of stepping through your found set in a script to identify the group with the largest count.