I am using a simple median formula in cell D1 = Median(C:C), there are about 350000 rows of employee numbers in column A & Names in Col B & Salaries in Col C .
If you have "only" 350,000 rows, it would be better to write =MEDIAN(C1:C350000).
If you use C:C, Excel might have to look at all 1,048,576 rows. This becomes more important if you use the form C:C in array-entered formulas.
Assume the median value is 18567 in Cell D1. now if I want to get median value to become 20000, how many more employee to be recruited ( rows to be added) and with what salary.
There is no single answer. It is easy to calculate the
minimum additional employees; but you add more. However, there might be no limit on the salaries.
Let me explain....
The median simply means that 50% of the data lies below and 50% of the data lies above.
So we can create a median of 18567 as follows:
1. Select A1:A175000, type =RANDBETWEEN(1,18566), press ctrl+Enter (not ctrl+shift+Enter), then copy and paste-value back into the selected range.
If you prefer, simply type any number less than 18567.
2. Select A175001:A350000, type =RANDBETWEEN(18568,1000000), press ctrl+Enter, then copy and paste-value back into the selected range.
If you prefer, simply type any number greater than 18567.
Note that 1,000,000 is an arbitrary upper limit. It can be as high or low as you wish, as long as it 18658 or more.
3. Enter 18567 into A350001.
Then =MEDIAN(A1:A350001) returns 18567.
4. Enter =COUNTIF(A1:A350001,"<20000") into B1. Enter =COUNTIF(A1:A350001,">20000") into B2.
5. Enter =ABS(B2-B1) into B3. This (plus one?) is the
minimum additional employees.
6. Enter 20000 into A350002 to be sure there is at least one 20000.
This is unnecessary if you want to verify that =COUNTIF(A1:A350001,20000) is not zero.
7. Select the number of cells below A350002 indicated by B3.
For example, if B3 is 545, select A350003:A350547.
7. If B1 < B2 (more values over 20000), type =RANDBETWEEN(1,19999), press ctrl+Enter, then copy and paste-value back into the selected range.
If you prefer, simply type any number less than 20000.
8. If B1 > B2 (more values under 20000), type =RANDBETWEEN(20001,1000000), press ctrl+Enter, then copy and paste-value back into the selected range.
If you prefer, simply type any number more than 20000.
Then =MEDIAN(A1:A350547) returns 20000.
Of course, "A350547" should be replaced by the last row number that you selected in step #7.