Conditional Median of Specific Cells

jbolduc123

New Member
Joined
Mar 22, 2018
Messages
3
Hi,
I hope this makes sense.....:confused: I'm trying to calculate the median of salaries that meet a set of criteria. I've looked at other threads, and tried the {=Median(if(A1:A16=criteria,B1:B16))}. This formula works, but it's not returning the median I'm looking for.

For example, I want to find the separate Median Base Salary of all positions titled Position #1 , all the positions titled Position #2 , Position #3 , etc. (in the table below), without having to manually select the range in column B. Any and all help is greatly appreciated.

[ColumnA]
Position #
[ColumnB]
Base Salary
[ColumnC]
Median Salary
Position #1 $204,750.00 $204,750.00
Position #2 $155,000.00 $155,112.00
Position #2 $155,224.00 $155,112.00
Position #3 $208,464.00 $208,464.00
Position #4 $175,000.00 $189,037.50
Position #4 $203,075.00 $189,037.50
Position #5 $195,209.00 $199,142.00
Position #5 $203,075.00 $199,142.00
Position #6 $180,000.00 $203,075.00
Position #6 $203,075.00 $203,075.00
Position #6 $231,750.00 $203,075.00
Position #7 $165,661.00 $203,075.00
Position #7 $203,075.00 $203,075.00
Position #7 $230,000.00 $203,075.00

<tbody>
</tbody>
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
A​
B​
C​
D​
1​
Position #
Base Salary
Median Salary
2​
Position #1
$204,750.00​
$204,750.00​
C2: {=IF(A2=A1, "", MEDIAN(IF($A$2:$A$15=A2, $B$2:$B$15)))}
3​
Position #2
$155,000.00​
$155,112.00​
4​
Position #2
$155,224.00​
5​
Position #3
$208,464.00​
$208,464.00​
6​
Position #4
$175,000.00​
$189,037.50​
7​
Position #4
$203,075.00​
8​
Position #5
$195,209.00​
$199,142.00​
9​
Position #5
$203,075.00​
10​
Position #6
$180,000.00​
$203,075.00​
11​
Position #6
$203,075.00​
12​
Position #6
$231,750.00​
13​
Position #7
$165,661.00​
$203,075.00​
14​
Position #7
$203,075.00​
15​
Position #7
$230,000.00​

The results you show area are correct -- what's your question?
 
Upvote 0
The results you show area are correct -- what's your question?

At a guess, I'd say the results shown are those required.

But the original formula didn't lock rows 1:16, hence would have thrown the occasional wrong result when copied down the column.
 
Upvote 0
Thanks so much for the quick response! My challenge, is that Column C can't have blanks. For example, there are 2 Position #2 lines, and they both need to reflect the same median (for their position title only).

Is this doable?

Many thanks!
 
Upvote 0
Hi,

As mentioned by shg and Stephen, your formula is Already doing that, so still don't understand your problem...


Book1
ABC
1Position #Base SalaryYour Formula
2Position #1$204,750.00$204,750.00
3Position #2$155,000.00$155,112.00
4Position #2$155,224.00$155,112.00
5Position #3$208,464.00$208,464.00
6Position #4$175,000.00$189,037.50
7Position #4$203,075.00$189,037.50
8Position #5$195,209.00$199,142.00
9Position #5$203,075.00$199,142.00
10Position #6$180,000.00$203,075.00
11Position #6$203,075.00$203,075.00
12Position #6$231,750.00$203,075.00
13Position #7$165,661.00$203,075.00
14Position #7$203,075.00$203,075.00
15Position #7$230,000.00$203,075.00
Sheet25
Cell Formulas
RangeFormula
C2{=MEDIAN(IF(A$2:A$15=A2,B$2:B$15))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
AHA! I've got it!!! I was completely missing the CTRL+SHIFT+ENTER piece!

Thank you so much for all your help! :D

JB
 
Upvote 0
Great, yes, array formulas need to be enter by CSE, glad you got it working.

You're welcome, welcome to the forum.
 
Upvote 0

Forum statistics

Threads
1,214,648
Messages
6,120,726
Members
448,987
Latest member
marion_davis

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top