the Median() function is designed to find the median of all the values in a single field or formula. You are trying to find the median of 3 separate fields. Therefore, you will most likely need to either: 1) write a formula that creates an array out of your 3 fields, then a second formula finding the median() value of that formula; or 2) manually write a formula to handle the median calculation. The second option is more complicated, and involves determining whether your result set is even or odd; then sorting the results by absolute value, then locating/calculating the median of those values.
I'd recommend searching for how to set up an array, then taking the medain of the array formula.
The following will find the median of 3 fields, replace the items in bold with your field names :
Local NumberVar Num1 := 100;
Local NumberVar Num2 := 300;
Local NumberVar Num3 := 150;
If Num1 < Num2 and Num1 > Num3 then Num1 else
If Num1 > Num2 and Num1 < Num3 then Num1 else
If Num2 < Num1 and Num2 > Num3 then Num2 else
If Num2 > Num1 and Num2 < Num3 then Num2 else
If Num3 < Num1 and Num3 > Num2 then Num3 else
If Num3 > Num1 and Num3 < Num2 then Num3
Reebo
UK
Please Note - Due to current economic forcast and budget constraints, the light at the end of the tunnel has been switched off. Thank you for your cooperation.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.