Finding Numbers from a Column Using Target Numbers

juken1

New Member
Joined
Jun 7, 2016
Messages
23
Hello,
Could I please have some excel help.
I'm looking for a formula to go into column H, I and J

Column H Formula: The formula I need to go into column H is using target numbers from Column F and G, use those target numbers to search Column D from top to bottom and whichever number is matched first (or if the "Target Higher" is matched first the number can go over or "Target Low: matched number can go lower)

Coumn I and J should be the time and date for the matched number.

For example purposes I've manually entered the results into the grey section (column H, I and J) to display what should be there if I can get a formula working.

[
mrexcel.xlsx
ABCDEFGHIJ
1NameDateTimeNumberNameTarget HighTarget LowTarget ReachedTarget DateTarget Time
2Steve1/01/202410:00:00 AM1Steve2.9132/01/202410:00:00 AM
3Steve1/01/20241:30:00 PM2John3224.8231/01/20241:30:00 PM
4Steve1/01/20242:00:00 PM1
5Steve2/01/202410:00:00 AM3
6Steve2/01/20241:30:00 PM4
7Steve2/01/20242:00:00 PM5
8Steve3/01/202410:00:00 AM3
9Steve3/01/20241:30:00 PM2
10Steve3/01/20242:00:00 PM1
11John1/01/202410:00:00 AM30
12John1/01/20241:30:00 PM23
13John1/01/20242:00:00 PM27
14John2/01/202410:00:00 AM22
15John2/01/20241:30:00 PM16
16John2/01/20242:00:00 PM19
17John3/01/202410:00:00 AM22
18John3/01/20241:30:00 PM21
19John3/01/20242:00:00 PM27
Data
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hi,
Why is the result for Steve 3? His target low is 1 and it is first matched in row D2.
 
Upvote 0
Which version of XL are you using?
 
Upvote 0
You should update your Account Details. Try this. The result returns the columns' order that matches your data but can be manipulated into the order you want if needed.
Book1
ABCDEFGHIJ
1NameDateTimeNumberNameTarget HighTarget LowTarget DateTarget TimeTarget Reached
2Steve1/1/240.416666671Steve2.911/1/240.4166671
3Steve1/1/240.56252John3224.81/1/240.562523
4Steve1/1/240.583333331
5Steve1/2/240.416666673
6Steve1/2/240.56254
7Steve1/2/240.583333335
8Steve1/3/240.416666673
9Steve1/3/240.56252
10Steve1/3/240.583333331
11John1/1/240.4166666730
12John1/1/240.562523
13John1/1/240.5833333327
14John1/2/240.4166666722
15John1/2/240.562516
16John1/2/240.5833333319
17John1/3/240.4166666722
18John1/3/240.562521
19John1/3/240.5833333327
Sheet4
Cell Formulas
RangeFormula
H2:J3H2=XLOOKUP(1,($A$2:$A$19=E2)*(($D$2:$D$19>=F2)+($D$2:$D$19<=G2)),$B$2:$D$19)
Dynamic array formulas.
 
Upvote 0
Thats look good thanks, is it possible to have the formula seraching after a specific time.

I've added column H as a time
So K column result for Steve should be 1 as i need the formula to look after 10:05AM for Steve

And for John result should be 33 as I need to look after 1:50 PM

Book1
ABCDEFGHIJK
1NameDateTimeNumberNameTarget HighTarget LowAfter TimeTarget DateTarget TimeTarget Reached
2Steve4529210:00:00 AM3Steve3110:05 AMMonday, 1 January 202410:00:00 AM3
3Steve452921:30:00 PM1John32251:50 PMMonday, 1 January 202410:00:00 AM4
4Steve452922:00:00 PM1
5Steve4529310:00:00 AM1
6Steve452931:30:00 PM1
7Steve452932:00:00 PM1
8Steve4529410:00:00 AM1
9Steve452941:30:00 PM1
10Steve452942:00:00 PM1
11John4529210:00:00 AM4
12John452921:30:00 PM5
13John452922:00:00 PM33
14John4529310:00:00 AM36
15John452931:30:00 PM4
16John452932:00:00 PM4
17John4529410:00:00 AM3
18John452941:30:00 PM4
19John452942:00:00 PM1
Sheet1
Cell Formulas
RangeFormula
I2:K3I2=XLOOKUP(1,($A$2:$A$19=E2)*(($D$2:$D$19>=F2)+($D$2:$D$19<=G2)),$B$2:$D$19)
Dynamic array formulas.
 
Upvote 0
Book1
ABCDEFGHIJK
1NameDateTimeNumberNameTarget HighTarget LowAfter TimeTarget DateTarget TimeTarget Reached
2Steve1/1/2410:00:00 AM3Steve3110:05:00 AM1/1/241:30:00 PM1
3Steve1/1/241:30:00 PM1John32251:50:00 PM1/1/242:00:00 PM33
4Steve1/1/242:00:00 PM1
5Steve1/2/2410:00:00 AM1
6Steve1/2/241:30:00 PM1
7Steve1/2/242:00:00 PM1
8Steve1/3/2410:00:00 AM1
9Steve1/3/241:30:00 PM1
10Steve1/3/242:00:00 PM1
11John1/1/2410:00:00 AM4
12John1/1/241:30:00 PM5
13John1/1/242:00:00 PM33
14John1/2/2410:00:00 AM36
15John1/2/241:30:00 PM4
16John1/2/242:00:00 PM4
17John1/3/2410:00:00 AM3
18John1/3/241:30:00 PM4
19John1/3/242:00:00 PM1
Sheet5
Cell Formulas
RangeFormula
I2:K3I2=XLOOKUP(1,($C$2:$C$19>=H2)*($A$2:$A$19=E2)*(($D$2:$D$19>=F2)+($D$2:$D$19<=G2)),$B$2:$D$19)
Dynamic array formulas.
 
Upvote 0
awesome thanks, does this formula support moving date column B? i moved date column to column L as a test but seems to have broken formula
 
Upvote 0
You would use HTACK. In the example, I've moved the date to F.
Book1
ABCDEFGHIJKLM
1NameTimeNumberDateNameTarget HighTarget LowAfter TimeTarget DateTarget TimeTarget Reached
2Steve10:00:00 AM31/1/24Steve3110:05:00 AM1/1/241:30:00 PM1
3Steve1:30:00 PM11/1/24John32251:50:00 PM1/1/242:00:00 PM33
4Steve2:00:00 PM11/1/24
5Steve10:00:00 AM11/2/24
6Steve1:30:00 PM11/2/24
7Steve2:00:00 PM11/2/24
8Steve10:00:00 AM11/3/24
9Steve1:30:00 PM11/3/24
10Steve2:00:00 PM11/3/24
11John10:00:00 AM41/1/24
12John1:30:00 PM51/1/24
13John2:00:00 PM331/1/24
14John10:00:00 AM361/2/24
15John1:30:00 PM41/2/24
16John2:00:00 PM41/2/24
17John10:00:00 AM31/3/24
18John1:30:00 PM41/3/24
19John2:00:00 PM11/3/24
Sheet5
Cell Formulas
RangeFormula
K2:M3K2=XLOOKUP(1,($C$2:$C$19>=J2)*($A$2:$A$19=G2)*(($D$2:$D$19>=H2)+($D$2:$D$19<=I2)),HSTACK($F$2:$F$19,$C$2:$D$19))
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,151
Members
453,021
Latest member
Justyna P

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