find range of date and time in column B then copy adjacent cell in column A into column D

nmk34

New Member
Joined
Apr 12, 2022
Messages
45
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
i have two columns A and B, where column B has date(date and time), column A has data values.
i want to look in column B for example for all cells from 6am to 7am then copy all adjacent cells in column A to column D. Thanks
 
is there a way to make this function to accommodate two more conditions as shown below?

=IFERROR(INDEX(A:A,AGGREGATE(15,6,ROW(A$2:A$20)/((MOD(B$2:B$20,1)>=F$2)*(MOD(B$2:B$20,1)<=F$3)*(A$2:A$20>=1134)*(A$2:A$20<=1149)),ROWS(D$2:D2))),"")
 
Upvote 0
Solution

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
just one more thing, is it possible to list each data in the target with its matching time stamp in a separate column? i want to chart the data with the correct time
 
Upvote 0
22 05 22.xlsm
ABCDEFG
1dataDate/timedataDate/timeParametetrs
2113423/05/2022 5:03114023/05/2022 6:036:00:00 AM
3114023/05/2022 6:03114523/05/2022 6:037:00:00 AM
4114223/05/2022 7:03113523/05/2022 6:03
5113623/05/2022 8:03  
6114623/05/2022 5:03  
7114523/05/2022 6:03  
8115223/05/2022 7:03  
9115023/05/2022 8:03  
10115223/05/2022 5:03  
11113223/05/2022 6:03  
12113623/05/2022 7:03  
13115223/05/2022 8:03  
14114923/05/2022 5:03  
15115123/05/2022 6:03  
16114523/05/2022 7:03  
17114823/05/2022 8:03  
18115123/05/2022 7:03  
19113823/05/2022 8:03  
20113523/05/2022 6:03  
Check Time (3)
Cell Formulas
RangeFormula
D2:D20D2=IFERROR(INDEX(A:A,AGGREGATE(15,6,ROW(A$2:A$20)/((MOD(B$2:B$20,1)>=G$2)*(MOD(B$2:B$20,1)<=G$3)*(A$2:A$20>=1134)*(A$2:A$20<=1149)),ROWS(D$2:D2))),"")
E2:E20E2=IFERROR(INDEX(B:B,AGGREGATE(15,6,ROW(B$2:B$20)/((MOD(B$2:B$20,1)>=G$2)*(MOD(B$2:B$20,1)<=G$3)*(A$2:A$20>=1134)*(A$2:A$20<=1149)),ROWS(B$2:B2))),"")
 
Upvote 0
I posting under the same question because i am using in the attachment the formulas above by peter_SSs.
i am using this formula to extract the data from column B and the time stamp from column C.
The creterias:
1) time from now 5minutes, 30minutes,1hour,4hours and 8hours.
2) minimum and max limits
the formulas as in the excel workbook are working, the problem, excel is using a long time to do the calculations.
the workbook is stripped from all other sensitive information to focus on this issue. two buttons on the sheet, one to clear the data columns b and c. the other one generate a new incoming data and time stamp. is there a better way or modify the existing code to make the calculation faster?
 
Upvote 0
Averageanaylsis2.xlsm
ABCDEFGHIJKLMNOPQRS
1DATA IN COLUMN #2TimeWeight(1 hour ago)TargetCurrent Time1 Hour Ago30 Min Ago4 Hours Ago8 Hours Ago5 Min Ago202122
2TIME IN COLUMN # 1/3/19003  5/28/2022 18:5617:56:2918:26:2914:56:2910:56:2918:51:29
3ROW #Weight DATATIME STAMP=IFERROR(INDEX(C:C,AGGREGATE(15,6,ROW(C$4:C$3000)/((MOD(C$4:C$3000,1)>=$L$3)*(MOD(C$4:C$3000,1)<=$K$3)*(B$4:B$3000>=$K$6)*(B$4:B$3000<=$L$6)),ROWS(B$4:B5))),"")=IFERROR(INDEX(B:B,AGGREGATE(15,6,ROW(B$4:B$3000)/((MOD(C$4:C$3000,1)>=L$3)*(MOD(C$4:C$3000,1)<=K$3)*(B$4:B$3000>=K$6)*(B$4:B$3000<=L$6)),ROWS(F$2:F3))),"")018:56:2817:56:2918:26:2914:56:2910:56:2918:51:29
4#N/A
5minmax
6907917
7
8TIME(30MIN)Weight(30 MIN ago)TIME(4HRS)Weight(4hrs ago)TIME(8HRS)Weight(8hrs ago)TIME(5MIN)Weight(5 MIN ago)
9=IFERROR(INDEX(C:C,AGGREGATE(15,6,ROW(C$4:C$3000)/((MOD(C$4:C$3000,1)>=$M$3)*(MOD(C$4:C$3000,1)<=$K$3)*(B$4:B$3000>=$K$6)*(B$4:B$3000<=$L$6)),ROWS(B$4:B4))),"")=IFERROR(INDEX(B:B,AGGREGATE(15,6,ROW(B$4:B$3000)/((MOD(C$4:C$3000,1)>=M$3)*(MOD(C$4:C$3000,1)<=K$3)*(B$4:B$3000>=K$6)*(B$4:B$3000<=L$6)),ROWS(L$9:L9))),"")=IFERROR(INDEX(C:C,AGGREGATE(15,6,ROW(C$4:C$3000)/((MOD(C$4:C$3000,1)>=$N$3)*(MOD(C$4:C$3000,1)<=$K$3)*(B$4:B$3000>=$K$6)*(B$4:B$3000<=$L$6)),ROWS(B$4:B4))),"")=IFERROR(INDEX(B:B,AGGREGATE(15,6,ROW(B$4:B$3000)/((MOD(C$4:C$3000,1)>=N$3)*(MOD(C$4:C$3000,1)<=K$3)*(B$4:B$3000>=K$6)*(B$4:B$3000<=L$6)),ROWS(N$9:N9))),"")=IFERROR(INDEX(C:C,AGGREGATE(15,6,ROW(C$4:C$3000)/((MOD(C$4:C$3000,1)>=$O$3)*(MOD(C$4:C$3000,1)<=$K$3)*(B$4:B$3000>=$K$6)*(B$4:B$3000<=$L$6)),ROWS(B$4:B4))),"")=IFERROR(INDEX(B:B,AGGREGATE(15,6,ROW(B$4:B$3000)/((MOD(C$4:C$3000,1)>=O$3)*(MOD(C$4:C$3000,1)<=K$3)*(B$4:B$3000>=K$6)*(B$4:B$3000<=L$6)),ROWS(O$9:O9))),"")=IFERROR(INDEX(C:C,AGGREGATE(15,6,ROW(C$4:C$3000)/((MOD(C$4:C$3000,1)>=$P$3)*(MOD(C$4:C$3000,1)<=$K$3)*(B$4:B$3000>=$K$6)*(B$4:B$3000<=$L$6)),ROWS(B$4:B4))),"")=IFERROR(INDEX(B:B,AGGREGATE(15,6,ROW(B$4:B$3000)/((MOD(C$4:C$3000,1)>=P$3)*(MOD(C$4:C$3000,1)<=K$3)*(B$4:B$3000>=K$6)*(B$4:B$3000<=L$6)),ROWS(P$9:P9))),"")
10
11
12
13
14
15
16
17
18
Sheet1
Cell Formulas
RangeFormula
E2E2=IFERROR(INDEX(C:C,AGGREGATE(15,6,ROW(C$4:C$3000)/((MOD(C$4:C$3000,1)>=$L$3)*(MOD(C$4:C$3000,1)<=$K$3)*(B$4:B$3000>=$K$6)*(B$4:B$3000<=$L$6)),ROWS(B$4:B4))),"")
F2F2=IFERROR(INDEX(B:B,AGGREGATE(15,6,ROW(B$4:B$3000)/((MOD(C$4:C$3000,1)>=L$3)*(MOD(C$4:C$3000,1)<=K$3)*(B$4:B$3000>=K$6)*(B$4:B$3000<=L$6)),ROWS(F$2:F2))),"")
L2L2=NOW()-1/24
M2M2=NOW()-1/24/2
N2N2=NOW()-4/24
O2O2=NOW()-8/24
P2P2=NOW()-1/24/2/6
G3G3=IF(F3="","",G2)
K3:P3K3=TIME(HOUR(K2),MINUTE(K2),SECOND(K2))
K4K4=INDEX(X2:X9,MATCH(K6,Y2:Y9,0))
Named Ranges
NameRefers ToCells
ChartTarget=OFFSET(Sheet1!$G$2,0,0,COUNTA(Sheet1!$G:$G) -1,1)G3
ChartValues=OFFSET(Sheet1!$F$2,0,0,COUNTA(Sheet1!$F:$F) -1,1)F2
 

Attachments

  • minisheet_image_withdata.PNG
    minisheet_image_withdata.PNG
    57.6 KB · Views: 6
Upvote 0
i solved this problem with inclosing the formulas in if statements.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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