# Calculate Median of a set of values

Need to calculate median of a set of values in rpa…Please help

@Gaurav_Gupta1 Median Like the Actual Statistic median or Do you want to find the Average Value? 1 Like

Where are the values stored?

Generally, you can sort whatever it is from low to high (e.g. an array, column) and then work out if the remainder of dividing the total count of values by 2 is zero. If the answer is not equal to zero, the median is the index value at the halfway mark.

If it is not zero, -1 to the index, get the value. Then divide index value by the index value -1. That’ll be your median.

Example:

If Array.Length mod 2 != 0

Median = Array(Array.Length/2)

Else

Median = Array(Array.Length/2) + Array((Array.Length/2)-1))

4 Likes

statistic median

1 Like

@Gaurav_Gupta1 Can you provide us the values that we need to get the median for?

Values are saved in data table column

@Gaurav_Gupta1 Is there a Separate Method to Apply when there are Odd Numbers and when there are even Numbers?

Please help how to convert a data table column to array of type double
actually my data is saved in column of a double

Here’s an example

MedianCalc.zip (6.2 KB)

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.