Time and Date of Next Value in a 2 column search

reswan

New Member
Joined
Sep 28, 2020
Messages
1
Office Version
  1. 2010
Platform
  1. Windows
Trying to create a formula to work on values in column E and column F

I want the formula to look at the value in column E and see where the value next appears historically in either column E or column F. On finding the next occurrence of the value I would like to read the time and date in column A and column B and record it in the row of the initial search value.
The time and date to be recorded should go in column G and column H respectively.

I would like to carry out the same operation on the values in column F. Again looking to see where the next value appears in column E or column F. On finding the next historical occurrence of the value I would like to read the time and date in column A and column B and this time record in the row of the initial search value but place the time and date in column I and column J respectively.

BEFORE

Time and Date of Next Value in a 2 column search.xlsx
ABCDEFGHIJ
1DateTimeValue 1Value 2Time 1Date 1Time 2Date 2
217:0811/06/2019watchpen
318:0510/06/2019beltumbrella
416:4009/06/2019pipeshoes
516:0308/06/2019shoeswatch
614:2807/06/2019lighterumbrella
714:0306/06/2019penbelt
813:5405/06/2019umbrellapipe
912:5004/06/2019watchlighter
BEFORE


AFTER

Time and Date of Next Value in a 2 column search.xlsx
ABCDEFGHIJ
1DateTimeValue 1Value 2Time 1Date 1Time 2Date 2
217:0811/06/2019watchpen16:0308/06/201914:0306/06/2019
318:0510/06/2019beltumbrella14:0306/06/201914:2807/06/2019
416:4009/06/2019pipeshoes13:5405/06/201916:0308/06/2019
516:0308/06/2019shoeswatch12:5004/06/2019
614:2807/06/2019lighterumbrella12:5004/06/201913:5405/06/2019
714:0306/06/2019penbelt
813:5405/06/2019umbrellapipe
912:5004/06/2019watchlighter
AFTER


NB: dates are UK format

thanks for any solutions. Will want to apply the formulas over several thousand rows.

cross posted at another site but although I advised the formula supplied worked , it didn't when copying down through several thousand rows.


link to cross post, as per forum rules, Time and Date of Next Value
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Hi & welcome to MrExcel.
How about
+Fluff New.xlsm
ABCDEFGHIJ
1DateTimeValue 1Value 2Time 1Date 1Time 2Date 2
217:08:0011/06/2019watchpen16:03:0008/06/201914:03:0006/06/2019
318:05:0010/06/2019beltumbrella14:03:0006/06/201914:28:0007/06/2019
416:40:0009/06/2019pipeshoes13:54:0005/06/201916:03:0008/06/2019
516:03:0008/06/2019shoeswatch  12:50:0004/06/2019
614:28:0007/06/2019lighterumbrella12:50:0004/06/201913:54:0005/06/2019
714:03:0006/06/2019penbelt    
813:54:0005/06/2019umbrellapipe    
912:50:0004/06/2019watchlighter    
10
Results
Cell Formulas
RangeFormula
G2:H9G2=IFERROR(INDEX(A3:A$10,AGGREGATE(15,6,(ROW($E3:$E$10)-ROW($E3)+1)/($E3:$F$10=$E2),1)),"")
I2:J9I2=IFERROR(INDEX(A3:A$10,AGGREGATE(15,6,(ROW($E3:$E$10)-ROW($E3)+1)/($E3:$F$10=$F2),1)),"")
 
Upvote 0
Thanks for the welcome and reply. These 2 formulas work perfectly for me on the 10 row sample. Provide the expected results exactly.

What adjustments do I need to make these 2 formulas work over several thousand rows? Sometimes the value search doesn't get a match for quite a few rows.

Should I can adjust the cell references A3A$10 to A3A$200 , $E3:$E$200 , $E3:$F$200 ?

What does the -ROW($E3)+1) in the formula do?
 
Upvote 0
You can adjust them like
Excel Formula:
=IFERROR(INDEX(A3:A$5000,AGGREGATE(15,6,(ROW($E3:$E$5000)-ROW($E3)+1)/($E3:$F$5000=$E2),1)),"")
This will work down to row 5,000
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,237
Messages
6,123,811
Members
449,127
Latest member
Cyko

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