#1   Report Post  
Jason
 
Posts: n/a
Default Excel and ranges

My columns look something like this:

min max value
1 500 1
501 1000 1.2
1001 2000 1.7
2001 5000 2.3

Now, based on that, I want to have cell that allows you to enter a number.
Using that number, the cell next to it needs to determine the range the
entered value is in and return the value from the list about. Therefore, if
I enter 550, the next cell over would return 1.2. If I enter 497, it would
return 1.

I have a lame method that works now using if statements within if statements
but when I have more then 9 ranges, Excel won't work because Excel has a
limit of 9 embedded if statements. I need to support up to 20 or so ranges
as opposed to the 4 ranges above.

If someone can help me out, I'd appreciate it a TON! I'm fairly well versed
in Excel so get as technical as you'd like. If VBA is the only easy answer,
then I can do that without help. I just wanted to get around using VBA if at
all possible.

Thanks in advance!
  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

How about a table on sheet2 that looks like:

0 1
501 1.2
1001 1.7
2001 2.3


And then just use
=vlookup(a1,sheet2!a:b,2)

Jason wrote:

My columns look something like this:

min max value
1 500 1
501 1000 1.2
1001 2000 1.7
2001 5000 2.3

Now, based on that, I want to have cell that allows you to enter a number.
Using that number, the cell next to it needs to determine the range the
entered value is in and return the value from the list about. Therefore, if
I enter 550, the next cell over would return 1.2. If I enter 497, it would
return 1.

I have a lame method that works now using if statements within if statements
but when I have more then 9 ranges, Excel won't work because Excel has a
limit of 9 embedded if statements. I need to support up to 20 or so ranges
as opposed to the 4 ranges above.

If someone can help me out, I'd appreciate it a TON! I'm fairly well versed
in Excel so get as technical as you'd like. If VBA is the only easy answer,
then I can do that without help. I just wanted to get around using VBA if at
all possible.

Thanks in advance!


--

Dave Peterson
  #3   Report Post  
Chris Lavender
 
Posts: n/a
Default

You should use VLOOKUP with 1 as the final argument, ie

=vlookup(targetcell,A2:C5,3,1) assuming 'min' is in cell A1

Using 1 as the final argument tells XL to find the nearest match rather than
an exact match for eg, 497. Your min column needs to be in ascending order,
though.

Best rgds
Chris Lav

"Jason" wrote in message
...
My columns look something like this:

min max value
1 500 1
501 1000 1.2
1001 2000 1.7
2001 5000 2.3

Now, based on that, I want to have cell that allows you to enter a number.
Using that number, the cell next to it needs to determine the range the
entered value is in and return the value from the list about. Therefore,

if
I enter 550, the next cell over would return 1.2. If I enter 497, it

would
return 1.

I have a lame method that works now using if statements within if

statements
but when I have more then 9 ranges, Excel won't work because Excel has a
limit of 9 embedded if statements. I need to support up to 20 or so

ranges
as opposed to the 4 ranges above.

If someone can help me out, I'd appreciate it a TON! I'm fairly well

versed
in Excel so get as technical as you'd like. If VBA is the only easy

answer,
then I can do that without help. I just wanted to get around using VBA if

at
all possible.

Thanks in advance!



  #4   Report Post  
Jason
 
Posts: n/a
Default

Thanks a TON...that works great!

"Chris Lavender" wrote:

You should use VLOOKUP with 1 as the final argument, ie

=vlookup(targetcell,A2:C5,3,1) assuming 'min' is in cell A1

Using 1 as the final argument tells XL to find the nearest match rather than
an exact match for eg, 497. Your min column needs to be in ascending order,
though.

Best rgds
Chris Lav

"Jason" wrote in message
...
My columns look something like this:

min max value
1 500 1
501 1000 1.2
1001 2000 1.7
2001 5000 2.3

Now, based on that, I want to have cell that allows you to enter a number.
Using that number, the cell next to it needs to determine the range the
entered value is in and return the value from the list about. Therefore,

if
I enter 550, the next cell over would return 1.2. If I enter 497, it

would
return 1.

I have a lame method that works now using if statements within if

statements
but when I have more then 9 ranges, Excel won't work because Excel has a
limit of 9 embedded if statements. I need to support up to 20 or so

ranges
as opposed to the 4 ranges above.

If someone can help me out, I'd appreciate it a TON! I'm fairly well

versed
in Excel so get as technical as you'd like. If VBA is the only easy

answer,
then I can do that without help. I just wanted to get around using VBA if

at
all possible.

Thanks in advance!




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Relative Ranges in excel macro edself Excel Discussion (Misc queries) 6 October 13th 05 02:02 PM
Excel will not include all of my non-adj ranges in a named range?? Renlimanit Excel Worksheet Functions 3 September 22nd 05 02:34 PM
trying to import excel database into outlook need to name ranges Shawnee Wright Excel Worksheet Functions 2 July 20th 05 02:22 AM
how do I name ranges of data in Excel to export to Outlook? Liz Rava Excel Discussion (Misc queries) 3 June 2nd 05 11:33 PM
how do I name ranges in an Excel worksheet becca122121 Excel Worksheet Functions 4 November 8th 04 06:14 PM


All times are GMT +1. The time now is 12:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"