🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.ibm.pc.misc
Article #9935

Re: median calculation in Quattro?

#9935
From: David Halliwell
Date: Wed, 15 May 1991 20:26
40 lines
2296 bytes
In article <1991May13.192140.19039@magnus.acs.ohio-state.edu>, pjd@magnus.acs.ohio-state.edu (Peter J Dotzauer) writes:
>is it possible to tickle Quattro into calculating the median of a column
>of cells. The median is obviously not among the implemented statistical
>functions.
> 
>Perhaps some kind of public domain macro exists for that type of
>problem?
> 
>-- 
  
   I used to have a macro floating around that did this sort of thing,
but I don't have a copy of it anymore. Basically, what you need to do is:
  
  - copy the column to a work area (unless you aren't worried about
    messing up the original).
  - sort the column (the copy)
  - count the number of values in the column.
  - if there are an odd number of values, the median is the middle one.
  - if there are an even number of values, average the two "middle" ones.
  
  For flexibility, you may want to set up named ranges. This is 
particularly handy if you want to work with a large number of variable-
length data sets. You will have to use a conditional statement either
in the formula for the median or in the macro, to handle the odd/even
number of values. For example, you may just want to set up the median
formula as the average of a range named "middle". The macro then
sets "middle" to be the middle one or two values in the data set. However,
it is probably easier to have an @IF median function, which uses an
index into the column of data, in the form of a lookup table.
  
   Warning: named ranges that include only a single cell cannot be
redefined in the same manner as multiple-cell ranges: the existing
range will be A1 rather than A1..A1, and a macro containing an escape
code will not have the same effect.
  
  
   Hope this helps! When you get the macro written, post it :-)
  
  
Dave Halliwell
Technical Details
Message-ID: <RN.1223@mts.ucs.UAlberta.CA>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!van-bc!ubc-cs!alberta!mts.ucs.UAlberta.CA!David_Halliwell
References: <1991May13.192140.19039@magnus.acs.ohio-state.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!van-bc!ubc-cs!alberta!mts.ucs.UAlberta.CA!David_Halliwell
From: userDHAL@mts.ucs.UAlberta.CA (David Halliwell)
Newsgroups: comp.sys.ibm.pc.misc
Subject: Re: median calculation in Quattro?
Message-ID: <RN.1223@mts.ucs.UAlberta.CA>
Date: Wed, 15 May 91 20:26:33 GMT
Organization: MTS Univ of Alberta     
References: <1991May13.192140.19039@magnus.acs.ohio-state.edu>
Lines: 40