>From a pseudocode point-of-view, make an array of your set of numbers,
then sort the array (ArraySort function).  From the sorted array, get
the number of items in the array and divide by 2 and round up the
results to an integer.  This will work fine for an odd number of set
elements.  Then grab that element number from the sorted array.  If
there are an even number of set elements (say 10), you'll need to
customize the code to grab the 5th or 6th element from the sorted array,
depending on how you determine the median of an even numbered set.

HTH...

-- David


-----Original Message-----
From: Alford, Gary [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 25, 2001 6:50 AM
To: DFW ColdFusion Users Group (E-mail)
Subject: Median Function


Is there a CFML "function" that will find the median of a set of
numbers?
MS Access 97 used "DMedian" to perform this task, but I can't seem to
find
an equivalent in ColdFusion.

============================================
Gary L. Alford
Supplier Product Assurance
Bell Helicopter Textron
Phone: (817) 280-6233
Fax: (817) 278-6233
mailto:[EMAIL PROTECTED]
============================================


------------------------------------------------------------------------
-
This email server is running an evaluation copy of the MailShield anti-
spam software. Please contact your email administrator if you have any
questions about this message. MailShield product info:
www.mailshield.com

-----------------------------------------------
To post, send email to [EMAIL PROTECTED]
To subscribe / unsubscribe: http://www.dfwcfug.org

-------------------------------------------------------------------------
This email server is running an evaluation copy of the MailShield anti-
spam software. Please contact your email administrator if you have any
questions about this message. MailShield product info: www.mailshield.com

-----------------------------------------------
To post, send email to [EMAIL PROTECTED]
To subscribe / unsubscribe: http://www.dfwcfug.org

Reply via email to