Hi,
I need help finding some way out in VBA or just formula .My conditions are :
Main column is " D ", if Column J is "Open" then i need next great value from column "C" to column "E" and vise versa .(attached snapshot)
and it copy high time when it status is OPEN, other wise should look for next open statusu can see the arrows ... it should take the next higher time from the all list ... andin end it should give zero as there is no more high value for 200255
Book1 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | |||
1 | |||||||||||
2 | |||||||||||
3 | 1/14/2020 | 10:10:10 | 200255 | 12:10:10 PM | Open | ||||||
4 | 1/14/2020 | 12:10:10 | 200255 | Close | |||||||
5 | 1/14/2020 | 14:10:10 | 200255 | Close | |||||||
6 | 1/14/2020 | 16:10:10 | 200255 | Close | |||||||
7 | 1/14/2020 | 19:10:10 | 200255 | Close | |||||||
8 | 1/14/2020 | 20:10:10 | 200255 | Close | |||||||
9 | 1/14/2020 | 23:10:10 | 200255 | Close | |||||||
10 | 1/15/2020 | 19:10:10 | 200245 | Close | |||||||
11 | 1/15/2020 | 23:10:10 | 200245 | Close | |||||||
12 | 1/15/2020 | 03:10:10 | 200245 | Close | |||||||
13 | 1/15/2020 | 07:10:10 | 200245 | Close | |||||||
14 | 1/15/2020 | 11:10:10 | 200245 | Close | |||||||
15 | 1/15/2020 | 15:10:10 | 200245 | 7:10:10 PM | Open | ||||||
16 | 1/15/2020 | 19:10:10 | 200245 | Close | |||||||
17 | 1/15/2020 | 23:10:10 | 200245 | Close | |||||||
18 | 1/15/2020 | 03:10:10 | 200245 | Close | |||||||
19 | 1/15/2020 | 07:10:10 | 200245 | Close | |||||||
20 | 1/15/2020 | 11:10:10 | 200245 | Close | |||||||
21 | 1/15/2020 | 15:10:10 | 200245 | Close | |||||||
Sheet1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
E3:E21 | E3 | =IFERROR(INDEX($C$3:$C$21,(ROW($E$3:$E$21)-ROW($E$3)+1)/($I$3:$I$21="Open")*ROWS($C$3:C4)),"") |
Book1 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | |||
1 | |||||||||||
2 | |||||||||||
3 | 1/14/2020 | 10:10:10 | 200255 | 12:10:10 | Open | ||||||
4 | 1/14/2020 | 12:10:10 | 200255 | 14:10:10 | Close | ||||||
5 | 1/14/2020 | 14:10:10 | 200255 | 16:10:10 | Close | ||||||
6 | 1/14/2020 | 16:10:10 | 200255 | 19:10:10 | Close | ||||||
7 | 1/14/2020 | 19:10:10 | 200255 | 20:10:10 | Close | ||||||
8 | 1/14/2020 | 20:10:10 | 200255 | 23:10:10 | Close | ||||||
9 | 1/15/2020 | 19:10:10 | 200245 | Close | |||||||
10 | 1/15/2020 | 23:10:10 | 200245 | Close | |||||||
11 | 1/14/2020 | 23:10:10 | 200255 | Close | |||||||
12 | 1/15/2020 | 03:10:10 | 200245 | Close | |||||||
13 | 1/15/2020 | 07:10:10 | 200245 | Close | |||||||
14 | 1/15/2020 | 11:10:10 | 200245 | Close | |||||||
15 | 1/15/2020 | 15:10:10 | 200245 | 19:10:10 | Open | ||||||
16 | 1/15/2020 | 19:10:10 | 200245 | 23:10:10 | Close | ||||||
17 | 1/15/2020 | 23:10:10 | 200245 | 03:10:10 | Close | ||||||
18 | 1/15/2020 | 03:10:10 | 200245 | 07:10:10 | Close | ||||||
19 | 1/15/2020 | 07:10:10 | 200245 | 11:10:10 | Close | ||||||
20 | 1/15/2020 | 11:10:10 | 200245 | 15:10:10 | Close | ||||||
21 | 1/15/2020 | 15:10:10 | 200245 | Close | |||||||
22 | |||||||||||
Sheet1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
E3:E21 | E3 | =IFERROR(INDEX($C$3:$C$21,AGGREGATE(15,6,(ROW($D$3:$D$21)-ROW($D$3)+1)/((ROW($D$3:$D$21)-ROW($D$3)+1)>AGGREGATE(15,6,(ROW($D$3:$D$21)-ROW($D$3)+0)/($I$3:$I$21="Open"),COUNTIF($I$3:I3,"Open")))/($D$3:$D$21=INDEX($D$3:$D$21,AGGREGATE(15,6,(ROW($D$3:$D$21)-ROW($D$3)+1)/($I$3:$I$21="Open"),COUNTIF($I$3:I3,"Open")))),(ROWS($D$3:D3)-AGGREGATE(15,6,(ROW($D$3:$D$21)-ROW($D$3)+1)/($I$3:$I$21="Open"),COUNTIF($I$3:I3,"Open"))+1)+1)),"") |
x1.xlsx | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | |||
1 | |||||||||||
2 | |||||||||||
3 | 1/14/2020 | 10:10:10 | 200255 | 12:10:10 | Open | ||||||
4 | 1/14/2020 | 12:10:10 | 200255 | 14:10:10 | Close | ||||||
5 | 1/14/2020 | 14:10:10 | 200255 | 16:10:10 | Close | ||||||
6 | 1/14/2020 | 16:10:10 | 200255 | 19:10:10 | Close | ||||||
7 | 1/14/2020 | 19:10:10 | 200255 | 20:10:10 | Close | ||||||
8 | 1/14/2020 | 20:10:10 | 200255 | 23:10:10 | Close | ||||||
9 | 1/15/2020 | 19:10:10 | 200245 | Close | |||||||
10 | 1/15/2020 | 23:10:10 | 200245 | Close | |||||||
11 | 1/14/2020 | 23:10:10 | 200255 | 0 | Close | ||||||
12 | 1/15/2020 | 03:10:10 | 200245 | Close | |||||||
13 | 1/15/2020 | 07:10:10 | 200245 | Close | |||||||
14 | 1/15/2020 | 11:10:10 | 200245 | Close | |||||||
15 | 1/15/2020 | 15:10:10 | 200245 | 19:10:10 | Open | ||||||
16 | 1/15/2020 | 19:10:10 | 200245 | 23:10:10 | Close | ||||||
17 | 1/15/2020 | 23:10:10 | 200245 | 03:10:10 | Close | ||||||
18 | 1/15/2020 | 03:10:10 | 200245 | 07:10:10 | Close | ||||||
19 | 1/15/2020 | 07:10:10 | 200245 | 11:10:10 | Close | ||||||
20 | 1/15/2020 | 11:10:10 | 200245 | 15:10:10 | Close | ||||||
21 | 1/15/2020 | 15:10:10 | 200245 | 0 | Close | ||||||
Sheet1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
E3:E4 | E3 | =IFERROR(INDEX($C$3:$C$21,AGGREGATE(15,6,(ROW($D$3:$D$21)-ROW($D$3)+1)/((ROW($D$3:$D$21)-ROW($D$3)+1)>AGGREGATE(15,6,(ROW($D$3:$D$21)-ROW($D$3)+0)/($I$3:$I$21="Open"),COUNTIF($I$3:I3,"Open")))/($D$3:$D$21=INDEX($D$3:$D$21,AGGREGATE(15,6,(ROW($D$3:$D$21)-ROW($D$3)+1)/($I$3:$I$21="Open"),COUNTIF($I$3:I3,"Open")))),(ROWS($D$3:D3)-AGGREGATE(15,6,(ROW($D$3:$D$21)-ROW($D$3)+1)/($I$3:$I$21="Open"),COUNTIF($I$3:I3,"Open"))+1)+1)),IF(COUNTIF($E2:E$3,C3)<>0,TEXT(0,"@"),"")) |
E5:E21 | E5 | =IFERROR(INDEX($C$3:$C$21,AGGREGATE(15,6,(ROW($D$3:$D$21)-ROW($D$3)+1)/((ROW($D$3:$D$21)-ROW($D$3)+1)>AGGREGATE(15,6,(ROW($D$3:$D$21)-ROW($D$3)+0)/($I$3:$I$21="Open"),COUNTIF($I$3:I5,"Open")))/($D$3:$D$21=INDEX($D$3:$D$21,AGGREGATE(15,6,(ROW($D$3:$D$21)-ROW($D$3)+1)/($I$3:$I$21="Open"),COUNTIF($I$3:I5,"Open")))),(ROWS($D$3:D5)-AGGREGATE(15,6,(ROW($D$3:$D$21)-ROW($D$3)+1)/($I$3:$I$21="Open"),COUNTIF($I$3:I5,"Open"))+1)+1)),IF(COUNTIF($E$3:E4,C5)<>0,TEXT(0,"@"),"")) |