2 range lookups..

ExcelNewbie2020

Active Member
Joined
Dec 3, 2020
Messages
333
Office Version
  1. 365
Platform
  1. Windows
I have this scenario.. i need to lookup a number if its within a range and if its within the range i need to lookup another number if it is also within a range..

for example in cell H5 (4450000) it is within the range in range 1 (from/to)..since it is within the range 2nd step is to check if cell I5 (12) if within range 2 (from/to).which is not so the result is "not ok".
for cells H6 and I6 since they are both within the range the result is "ok"..
for cell H7 outside the range result should be empty cell..



Book1
ABCDEFGHIJ
1range 1range 2
2fromtofromto
3410000049209991313
4410000049999991620range 1range 2formula here
5410000049999993133445000012not ok
6420000017ok
7510000025empty cell
8
9
10
11
12
13
14
Sheet1
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Try:

varios 28sep2024.xlsm
ABCDEFGHIJ
1range 1range 2
2fromtofromto
3410000049209991313
4410000049999991620range 1range 2formula here
5410000049999993133445000012not ok
6420000017ok
7510000025empty cell
Hoja4
Cell Formulas
RangeFormula
J5:J7J5=IF(SUMPRODUCT((H5>=$A$3:$A$5)*(H5<=B3:B5)*(I5>=C3:C5)*(I5<=D3:D5)),"ok",IF(OR(SUMPRODUCT((H5>=$A$3:$A$5)*(H5<=B3:B5)),SUMPRODUCT((I5>=C3:C5)*(I5<=D3:D5))),"not ok","empty cell"))
 
Upvote 0
I was missing some $
Try:
varios 28sep2024.xlsm
ABCDEFGHIJ
1range 1range 2
2fromtofromto
3410000049209991313
4410000049999991620range 1range 2formula here
5410000049999993133445000012not ok
6420000017ok
7510000025empty cell
Hoja4
Cell Formulas
RangeFormula
J5:J7J5=IF(SUMPRODUCT((H5>=$A$3:$A$5)*(H5<=$B$3:$B$5)*(I5>=$C$3:$C$5)*(I5<=$D$3:$D$5)),"ok",IF(OR(SUMPRODUCT((H5>=$A$3:$A$5)*(H5<=$B$3:$B$5)),SUMPRODUCT((I5>=$C$3:$C$5)*(I5<=$D$3:$D$5))),"not ok","empty cell"))



Or the 365 version:
Excel Formula:
=LET(a,SUMPRODUCT((H5>=$A$3:$A$5)*(H5<=$B$3:$B$5)),b,SUMPRODUCT((I5>=$C$3:$C$5)*(I5<=$D$3:$D$5)),IF(a*b,"ok",IF(OR(a,b),"not ok","empty cell")))
 
Upvote 0
Solution
A small change:

Excel Formula:
=LET(a,SUMPRODUCT((H5>=$A$3:$A$5)*(H5<=$B$3:$B$5)),b,SUMPRODUCT((I5>=$C$3:$C$5)*(I5<=$D$3:$D$5)),IF(a*b,"ok",IF(a+b,"not ok","empty cell")))
 
Upvote 0
The sumproduct function is not necessary, and it is only necessary to put the following formula in cell J5:

Excel Formula:
=LET(a,(A3:A5<=H5:H7)*(B3:B5>=H5:H7),b,(C3:C5<=I5:I7)*(D3:D5>=I5:I7),IF(a*b,"ok",IF(a+b,"not ok","empty cells")))




🤗
 
Last edited:
Upvote 0
The sumproduct function is not necessary, and it is only necessary to put the following formula in cell J5:

Excel Formula:
=LET(a,(A3:A5<=H5:H7)*(B3:B5>=H5:H7),b,(C3:C5<=I5:I7)*(D3:D5>=I5:I7),IF(a*b,"ok",IF(a+b,"not ok","empty cells")))




🤗
thanks man, sumproduct works fine..
 
Upvote 1

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

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