Lookup a value after condition met

henryvii99

New Member
Joined
Apr 22, 2011
Messages
32
Hello,

I would like to lookup a value in specific column after condition is met
In my case, I want to report the time on row 1 after the time specified in table 2

Here's my example data:

TimePrice1Price2
18/5/2018 10:2540510
18/5/2018 10:2740020
18/5/2018 10:2939530
18/5/2018 10:3139040
18/5/2018 10:3340050
18/5/2018 10:3541045
18/5/2018 10:3742035
18/5/2018 10:3943065

<tbody>
</tbody>

Here's the control table, the specified time for table lookup is different for each column

Price 1Price 2
Start to count10:2710:33
Price at counting40050
Min. price38040
Max. price42060
Time when price below min.AC
Time when price reach max.BD

<tbody>
</tbody>

The expected values are:

A: N/A (as it never fall below min. price)
B: 10:37
C: 10:37 (not 10:29 as it does not reach specific time yet)
D: 10:39

I think I can use index to find my values, but the problem is I will only look for values after the specific time

Any help is much appreciated, many thanks for your help!
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Try these, copied across.

Excel Workbook
ABC
1TimePrice1Price2
218/05/2018 10:2540510
318/05/2018 10:2740020
418/05/2018 10:2939530
518/05/2018 10:3139040
618/05/2018 10:3340050
718/05/2018 10:3541045
818/05/2018 10:3742035
918/05/2018 10:3943065
10
11Price 1Price 2
12Start to count10:2710:33
13Price at counting40050
14Min. price38040
15Max. price42060
16Time when price below min.N/A10:37
17Time when price reach max.10:3710:39
Times
 
Last edited:
Upvote 0
A
B
C
D
E
F
G
1
TimePrice1Price2Price 1Price 2
2
5/18/2018 10:25​
405​
10​
Start to count
10:27​
10:33​
3
5/18/2018 10:27​
400​
20​
Price at counting
400​
50​
4
5/18/2018 10:29​
395​
30​
Min. price
380​
40​
5
5/18/2018 10:31​
390​
40​
Max. price
420​
60​
6
5/18/2018 10:33​
400​
50​
Time when price below min.
#NUM!​
10:37​
7
5/18/2018 10:35​
410​
45​
Time when price reach max.
10:37​
10:39​
8
5/18/2018 10:37​
420​
35​
9
5/18/2018 10:39​
430​
65​
Sheet: Sheet56

Array formula in F6:
=INDEX($A$2:$A$9,SMALL(IF(((A2:A9-INT(A2:A9))>=F2)*(B2:B9<=F4),MATCH(ROW(A2:A9),ROW(A2:A9)),""),1))

Array formula in F7:
=INDEX($A$2:$A$9,SMALL(IF(((A2:A9-INT(A2:A9))>=F2)*(B2:B9>=F5),MATCH(ROW(A2:A9),ROW(A2:A9)),""),1))

Array formula in G6:
=INDEX($A$2:$A$9,SMALL(IF(((A2:A9-INT(A2:A9))>=G2)*(C2:C9<=G4),MATCH(ROW(A2:A9),ROW(A2:A9)),""),1))

Array formula in G7:
=INDEX($A$2:$A$9,SMALL(IF(((A2:A9-INT(A2:A9))>=G2)*(C2:C9>=G5),MATCH(ROW(A2:A9),ROW(A2:A9)),""),1))
 
Upvote 0
Dear Peter_SSs,

Many, many thanks for your prompt reply!

However, as I copied these to excel 2007, it doesn't seem to work
B16 contains error and doesn't allow me to proceed, and B17 report as N/A


For B16, maybe it is

Code:
=IFERROR(AGGREGATE(15,6,MOD($A$2:$A$9,1)/((MOD($A$2:$A$9,1)>=B12)*(B$2:B$9<=B14)),1),"N/A")

I think we have to compare the below min cell at B14. Still it will report as N/A. Maybe my version is too old? Or matching time is a bit tricky?
 
Upvote 0
However, as I copied these to excel 2007, it doesn't seem to work
It won't - the AGGREGATE function was only introduced in Excel 2010.
For my layout, try these. They are array formulas so should be entered without the {} but confirmed with Ctrl+Shift+Enter, not just Enter. If confirmed correctly, Excel will insert the {}. The formulas can then be copied across.

Excel Workbook
ABC
1TimePrice1Price2
218/05/2018 10:2540510
318/05/2018 10:2740020
418/05/2018 10:2939530
518/05/2018 10:3139040
618/05/2018 10:3340050
718/05/2018 10:3541045
818/05/2018 10:3742035
918/05/2018 10:3943065
10
11Price 1Price 2
12Start to count10:2710:33
13Price at counting40050
14Min. price38040
15Max. price42060
16Time when price below min.N/A10:37
17Time when price reach max.10:3710:39
Times (2)
 
Upvote 0

Forum statistics

Threads
1,214,981
Messages
6,122,566
Members
449,089
Latest member
Motoracer88

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