Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Lookup value that falls between two values in a range and then som

I have an array with 4 columns:

A B C D
1 435 578 ID1
2 12 113 ID2
3 1478 1879 ID3
etc etc etc etc

The value I want to lookup has two components that correspond to column A
and a number that falls between columns B and C (or not):

E F
1 78
2 86
2 1500
3 1600
etc etc

So I'd like to ask is the value in column E = to the value in column A AND
does the value in column F fall between the values in columns B and C? If
yes, return column D.

In this example, I would get back:
#N/A
ID2
#N/A
ID3
etc

I hope I've explained this well.

Thanks in advance,
Richard

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 457
Default Lookup value that falls between two values in a range and then som

Something like this maybe?

=INDEX(D:D,SUMPRODUCT(--($A$2:$A$4=E2),--($B$2:$B$4<=F2),--($C$2:$C$4=F2),ROW($A$2:$A$4)))

formula evaluates to 0 if no result is found. Could encase this formula in
an IF function if "N/A" output is necessary.

--
Best Regards,

Luke M
"Richard Radcliffe" <Richard wrote in
message ...
I have an array with 4 columns:

A B C D
1 435 578 ID1
2 12 113 ID2
3 1478 1879 ID3
etc etc etc etc

The value I want to lookup has two components that correspond to column A
and a number that falls between columns B and C (or not):

E F
1 78
2 86
2 1500
3 1600
etc etc

So I'd like to ask is the value in column E = to the value in column A AND
does the value in column F fall between the values in columns B and C? If
yes, return column D.

In this example, I would get back:
#N/A
ID2
#N/A
ID3
etc

I hope I've explained this well.

Thanks in advance,
Richard



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Lookup value that falls between two values in a range and then som

In this example, I would get back:
#N/A
ID2
#N/A
ID3


=INDEX(D:D,SUMPRODUCT(--($A$2:$A$4=E2),--($B$2:$B$4<=F2),--($C$2:$C$4=F2),ROW($A$2:$A$4)))


With that formula I get these results:

ID1
ID2
ID3
ID3

When SUMPRODUCT = 0 then you get:

=INDEX(D:D,0)

Which evaluates the *entire* indexed range and if (because) the formula is
entered on row 2 (cell G2) you get the result that is within the implicit
intersection of D:D and G2 = ID1.

Try this...

=IF(F2=MEDIAN(F2,INDEX(B$2:C$4,MATCH(E2,A$2:A$4,0) ,0)),VLOOKUP(E2,A$2:D$4,4,0),#N/A)

Or this array** version:

=INDEX(D$2:D$4,MATCH(1,IF(A$2:A$4=E2,IF(F2=B$2:B$ 4,IF(F2<=C$2:C$4,1))),0))

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the SHIFT
key then hit ENTER.

--
Biff
Microsoft Excel MVP


"Luke M" wrote in message
...
Something like this maybe?

=INDEX(D:D,SUMPRODUCT(--($A$2:$A$4=E2),--($B$2:$B$4<=F2),--($C$2:$C$4=F2),ROW($A$2:$A$4)))

formula evaluates to 0 if no result is found. Could encase this formula in
an IF function if "N/A" output is necessary.

--
Best Regards,

Luke M
"Richard Radcliffe" <Richard wrote in
message ...
I have an array with 4 columns:

A B C D
1 435 578 ID1
2 12 113 ID2
3 1478 1879 ID3
etc etc etc etc

The value I want to lookup has two components that correspond to column A
and a number that falls between columns B and C (or not):

E F
1 78
2 86
2 1500
3 1600
etc etc

So I'd like to ask is the value in column E = to the value in column A
AND
does the value in column F fall between the values in columns B and C? If
yes, return column D.

In this example, I would get back:
#N/A
ID2
#N/A
ID3
etc

I hope I've explained this well.

Thanks in advance,
Richard





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
IF CELL VALUE FALLS WITHIN A RANGE OF VALUES Melvin Tang Excel Worksheet Functions 8 September 4th 07 04:59 AM
How do I use LOOKUP to return a range of values, then SUM values? irvine79 Excel Worksheet Functions 5 August 4th 06 01:33 PM
Checking if a certain day falls in a range Jaydubs Excel Discussion (Misc queries) 6 March 16th 06 01:51 PM
Countif if the value falls between 2 other values les8 New Users to Excel 3 December 7th 05 09:58 PM
Data falls in a range +/-1 SMac Excel Worksheet Functions 3 November 28th 05 08:34 PM


All times are GMT +1. The time now is 04:23 AM.

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

About Us

"It's about Microsoft Excel"