How to compare a cell value to ranges in an array

jvanhyfte

New Member
Joined
Feb 1, 2006
Messages
4
Hello All,
I have always found answers to me XL questions here. Thanks for the great forum!
My question is this...

I have groups of people that I have calculated ages. Each of these ages are used to calculate an insurance rate factor and then multiplied by a value to get a cost. I have attached the data table that I am using...

Age Employee
Low High Rate
0 29 $0.49
30 34 $0.58
35 39 $0.72
40 44 $0.99
45 49 $1.55
50 54 $2.40
55 59 $4.10
60 64 $6.25
65 69 $11.39
70 100 $23.57

How would I put together either a VBA script or a formula that would take someone's age (say an employee is 36), and find the range this person falls within (35-39), and then calculate the rate ($0.72)? I have about 200 records on 4 sheets that I have to calculate these values, so I'm thinking a VBA script would work, but I can't figure how...

Thanks!
 
Last edited:

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
LOOKUP() could work for you here.

eg.

=LOOKUP(36,A1:A10,C1:C10)

where A1:10 is the low age values and C1:C10 is the rate.

It assumes that the ages are sorted smallest to largest with no overlap/gaps in the age bands.
 
Upvote 0
LOOKUP() could work for you here.

eg.

=LOOKUP(36,A1:A10,C1:C10)

where A1:10 is the low age values and C1:C10 is the rate.

It assumes that the ages are sorted smallest to largest with no overlap/gaps in the age bands.
That is so close to the solution, but I need a cell reference returned in order for me to do the additional math. Any suggestions?


P.S.
I knew I would get the help needed, but am blown away by the quick response. Thanks!
 
Upvote 0
Why do you need a cell reference returned when the LOOKUP formula will return the appropriate value?
 
Upvote 0

Forum statistics

Threads
1,213,557
Messages
6,114,287
Members
448,562
Latest member
Flashbond

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