Nearest Rate

HuckFinn

New Member
Joined
Aug 1, 2006
Messages
45
I have a rate (i.e., a salary rate) in cell P8 in sheet A, and I want to find the nearest midpoint (another salary rate - column F shown below) from a salary structure in sheet B. Ultimately, I want the formula to return a grade level from the salary structure.

The challenge is that I have two separate salary structures, and depending on a specific criteria (i.e., location) I need the formula to look from the correct structure. I have been trying the INDEX & MATCH function, but am spinning my wheels. Location is in column J of sheet A and is listed as structure "A" or "B"

Capture.PNG

So for example, if job 1 has a market value of $47,650, the formula would return a value of 2 if the job was from structure 1 or some other value of it look at structure 2.

Any thoughts on how to accomplish this?
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
In this case, they are side by side. Midpoints for Structure A are F4:F23 and midpoints in Structure B are listed in cells O4:O10.
 
Upvote 0
The two salary structures are easy enough
IF(Structure="A", use formula1, use formula2)
the question is how to find the right midpoint

It can be done very simply if you add a helper column, that gives Excel the threshold figure for each grade, ie the point at which you start using the next grade.
And your criteria is to choose the grade whose midpoint is nearest the salary
That means the threshold between grades is halfway between the midpoints
So for the table above, your helper column is
Grade Threshold
1 0
2 45950 (the average of 43500 and 48400)
3 51100
4 56850
5 9999999 (very big so it's always larger than salary)

Then your formula is = MATCH(Salary,Threshold Column,1) which will return the grade number
 
Upvote 0
Hi HuckFinn,

So if your Sheet B structure is:

HuckFinn.xlsx
DEFGHIJLMNOPQR
2Structure AStructure B
3GradesMinimumMidpointMaximumRange SpreadGradesGradesMinimumMidpointMaximumRange SpreadGrades
41$ 36,300.00$ 43,550.00$ 50,800.0040%11$ 46,464.00$ 51,172.00$ 55,880.0020%1
52$ 40,300.00$ 48,400.00$ 56,500.0040%22$ 51,584.00$ 56,867.00$ 62,150.0020%2
63$ 44,800.00$ 53,800.00$ 62,800.0040%33$ 57,344.00$ 63,212.00$ 69,080.0020%3
74$ 49,900.00$ 59,900.00$ 69,900.0040%44$ 63,872.00$ 70,381.00$ 76,890.0020%4
85$ 55,500.00$ 66,600.00$ 77,700.0040%55$ 71,040.00$ 78,255.00$ 85,470.0020%5
Sheet B
Cell Formulas
RangeFormula
O4:O8,F4:F8F4=AVERAGE(E4,G4)
Q4:Q8,H4:H8H4=(G4-E4)/E4


You could just use a CHOOSE, but note this doesn't check for values being below Minimum or higher than Maximum:

HuckFinn.xlsx
JPQ
7StructureSalaryGrade
8A$ 47,650.002
9B$ 50,000.001
10A$ 22,222.001
11B$ 99,999.005
12A$ 57,777.004
13B$ 57,777.002
Sheet A
Cell Formulas
RangeFormula
Q8:Q13Q8=CHOOSE((J8="A")+1,INDEX('Sheet B'!$R$4:$R$8,MATCH(MIN(ABS('Sheet B'!$O$4:$O$8-P8)),ABS('Sheet B'!$O$4:$O$8-P8),0)),INDEX('Sheet B'!$I$4:$I$8,MATCH(MIN(ABS('Sheet B'!$F$4:$F$8-P8)),ABS('Sheet B'!$F$4:$F$8-P8),0)))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
That's a clever formula, Toadstool, but if it can be done with a little helper column and a formula of = MATCH(Salary,Threshold Column,1), as I suggested above, isn't it better to keep things simple? I worry when formulae get that complex, because they become almost impossible for ordinary users to deal with ,if anything goes wrong.
 
Upvote 0
Toadstool - That formula worked nicely. I appreciate it. I will check the min / max value issue. Thanks again for the quick response! Thanks also to Dermot.
 
Upvote 0
That's a clever formula, Toadstool, but if it can be done with a little helper column and a formula of = MATCH(Salary,Threshold Column,1), as I suggested above, isn't it better to keep things simple? I worry when formulae get that complex, because they become almost impossible for ordinary users to deal with ,if anything goes wrong.
I understand where you're coming from and I'll often suggest helper columns, but I was already working on the CSE entry when you posted and OPs often say they don't want helper columns so I thought I'd put it out there.

If you weren't keen on that then you're probably not going to like my approach if there's more than two Structures. ;)

HuckFinn.xlsx
DEFGHIMNOPQRVWXYZAA
2Structure AStructure BStructure C
3GradesMinimumMidpointMaximumRange SpreadGradesGradesMinimumMidpointMaximumRange SpreadGradesGradesMinimumMidpointMaximumRange SpreadGrades
41$ 36,300.00$ 43,550.00$ 50,800.0040%11$ 46,464.00$ 51,172.00$ 55,880.0020%11$ 23,500.00$ 29,500.00$ 35,500.0051%1
52$ 40,300.00$ 48,400.00$ 56,500.0040%22$ 51,584.00$ 56,867.00$ 62,150.0020%22$ 32,000.00$ 38,000.00$ 44,000.0038%2
63$ 44,800.00$ 53,800.00$ 62,800.0040%33$ 57,344.00$ 63,212.00$ 69,080.0020%33$ 40,500.00$ 46,500.00$ 52,500.0030%3
74$ 49,900.00$ 59,900.00$ 69,900.0040%44$ 63,872.00$ 70,381.00$ 76,890.0020%44$ 49,000.00$ 55,000.00$ 61,000.0024%4
85$ 55,500.00$ 66,600.00$ 77,700.0040%55$ 71,040.00$ 78,255.00$ 85,470.0020%55$ 57,500.00$ 63,500.00$ 69,500.0021%5
Sheet B
Cell Formulas
RangeFormula
X4:X8,O4:O8,F4:F8F4=AVERAGE(E4,G4)
Z4:Z8,Q4:Q8,H4:H8H4=(G4-E4)/E4


HuckFinn.xlsx
JPQ
7StructureSalaryGrade
8A$ 47,650.002
9B$ 50,000.001
10C$ 22,222.001
11A$ 99,999.005
12B$ 57,777.002
13C$ 60,000.005
Sheet A
Cell Formulas
RangeFormula
Q8:Q13Q8=MATCH(MIN(ABS(OFFSET('Sheet B'!$A$2,2,MATCH("Structure "&J8,'Sheet B'!$2:$2,0)+1,5)-P8)),ABS(OFFSET('Sheet B'!$A$2,2,MATCH("Structure "&J8,'Sheet B'!$2:$2,0)+1,5)-P8),0)
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0

Forum statistics

Threads
1,215,528
Messages
6,125,342
Members
449,218
Latest member
Excel Master

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