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:

Colin Legg

MrExcel MVP, Like totally RAD man
Joined
Feb 28, 2008
Messages
3,497
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.
 

jvanhyfte

New Member
Joined
Feb 1, 2006
Messages
4
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!
 

Scott Huish

MrExcel MVP
Joined
Mar 17, 2004
Messages
19,884
Why do you need a cell reference returned when the LOOKUP formula will return the appropriate value?
 

Forum statistics

Threads
1,081,752
Messages
5,361,085
Members
400,613
Latest member
Markdc123

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top