Return value in a certain time frame

Martinpetersson

New Member
Joined
Apr 27, 2022
Messages
31
Office Version
  1. 365
Platform
  1. Windows
Look up a value from a table on another sheet, based on its ID number and in a certain time frame. See attached minisheet.

I've made this testsheet, similar to the real one. Please help me to fill in formula in D25 & D29

S-flow_hus60_utg4.xlsx
ABCDEFG
1IDGood_partsTimeWeekYearDate
2121302022-06-22 06:052520222022-06-26
3216462022-06-22 07:562520222022-06-26
4864242022-06-22 09:552520222022-06-26
5864302022-06-22 11:352520222022-06-26
6121222022-06-22 14:302520222022-06-23
7121102022-06-23 08:302520222022-06-23
812152022-06-23 10:302520222022-06-23
9130452022-06-23 12:512520222022-06-23
10216442022-06-23 13:182520222022-06-23
111301032022-06-23 13:392520222022-06-23
12120752022-06-23 14:282520222022-06-23
13121202022-06-23 14:302520222022-06-23
14121102022-06-23 17:012520222022-06-26
1512152022-06-23 18:302520222022-06-23
16864242022-06-23 18:552520222022-06-26
17864302022-06-23 18:552520222022-06-26
18216462022-06-23 18:562520222022-06-26
19121102022-06-23 19:012520222022-06-26
20121302022-06-23 22:302520222022-06-23
21
22Sheet 2 below
23
24Date to check upGood parts with ID 121 between 06.00 -14.59
252022-06-23Should be 55
26Write any date ex. 2022-06-23Return sum of good parts in that timeframe
27
28Time and date nowGood parts with ID 121 between 06.00 -00:15
292022-06-27 14:51Should be 55
30Actual date nowReturn sum of good parts in that timeframe
test
Cell Formulas
RangeFormula
D25D25=+D29
B29B29=NOW()


Thank you for any help!
 
Here are the final exemple. Hope its easier to understand now. I'm sorry.
please fill in D33 D37 D42 D46

S-flow_hus60_utg4.xlsx
ABCD
1IDGood_partsTime
2121302022-06-22 06:05
3216462022-06-22 07:56
4864242022-06-22 09:55
5864302022-06-22 11:35
6121222022-06-22 14:30
7121102022-06-23 08:30
812152022-06-23 10:30
9130452022-06-23 12:51
10216442022-06-23 13:18
111301032022-06-23 13:39
12120752022-06-23 14:28
13121202022-06-23 14:30
14121102022-06-23 17:01
1512152022-06-23 18:30
16864242022-06-23 18:55
17864302022-06-23 18:55
18216462022-06-23 18:56
19121102022-06-23 19:01
20121302022-06-23 22:30
21121302022-06-24 00:12
22121302022-06-24 00:18
23121102022-06-27 10:00
2412152022-06-27 15:30
25
26
27
28
29
30Sheet 2 below
31
32Date to check upGood parts with ID 121 between 06.00 -14.59
332022-06-2335
34Write any date ex. 2022-06-23Return sum of good parts in that timeframe
35
36Good parts with ID 121 between 15.00 -00:15
3785
38Return sum of good parts in that timeframe
39
40
41Here i'm looking for the good parts deliverd until a certain time. Now()Good parts with ID 121 between 06.00 -14.59
4210
43Return sum of good parts in that timeframe
44
45Time and date nowGood parts with ID 121 between 15.00 -00:15
462022-06-27 16:055
47Actual date nowReturn sum of good parts in that timeframe
test
Cell Formulas
RangeFormula
B46B46=NOW()
 
Upvote 0

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Ok,
so you say times are
It is important to see the good parts from 6 am to 3 pm from that day. It iks also important to see the good parts from 3 pm to 12 pm (plus 15 minutes on following day.
Then in the text you put
Here i'm looking for the good parts deliverd until a certain time. Now()
if you need
6 am to 3 pm from that day.
AND
3 pm to 12 pm (plus 15 minutes on following day.

Fluff did post those formula - which should work - so we need to work out why they are NOT working

BUT if you mean
Here i'm looking for the good parts deliverd until a certain time. Now()
then explain is that the time NOW() up to 00:15

OR
6:00 to NOW()
OR
something else

Both timnes and now

Anyway - here is your later XL2BB with FLUFF formula added
Book1
ABCDE
1IDGood_partsTime
2121306/22/22 6:05
3216466/22/22 7:56
4864246/22/22 9:55
5864306/22/22 11:35
6121226/22/22 14:30
7121106/23/22 8:30
812156/23/22 10:30
9130456/23/22 12:51
10216446/23/22 13:18
111301036/23/22 13:39
12120756/23/22 14:28
13121206/23/22 14:30
14121106/23/22 17:01
1512156/23/22 18:30
16864246/23/22 18:55
17864306/23/22 18:55
18216466/23/22 18:56
19121106/23/22 19:01
20121306/23/22 22:30
21121306/24/22 0:12
22121306/24/22 0:18
23121106/27/22 10:00
2412156/27/22 15:30
25
26
27
28
29
30Sheet 2 below
31
32Date to check upGood parts with ID 121 between 06.00 -14.59
336/23/22 0:003535
34Write any date ex. 2022-06-23Return sum of good parts in that timeframe
35
36Good parts with ID 121 between 15.00 -00:15
378585
38Return sum of good parts in that timeframe
39
40
41Here i'm looking for the good parts deliverd until a certain time. Now()Good parts with ID 121 between 06.00 -14.59
4210
43Return sum of good parts in that timeframe
44
45Time and date nowGood parts with ID 121 between 15.00 -00:15
466/27/22 15:205
47Actual date nowReturn sum of good parts in that timeframe
48
Sheet2
Cell Formulas
RangeFormula
E33E33=SUMIFS(B2:B24,A2:A24,121,D2:D24,">="&B33+TIME(6,0,0),D2:D24,"<="&B33+TIME(14,59,0))
E37E37=SUMIFS(B2:B24,A2:A24,121,D2:D24,">="&INT(B33)+TIME(15,0,0),D2:D24,"<="&INT(B33)+1+TIME(0,15,0))
B46B46=NOW()
 
Last edited:
Upvote 0
As your data is on different sheets, try it like
Fluff.xlsm
ABCD
1IDGood_partsTime
21213022/06/2022 06:05
32164622/06/2022 07:56
48642422/06/2022 09:55
58643022/06/2022 11:35
61212222/06/2022 14:30
71211023/06/2022 08:30
8121523/06/2022 10:30
91304523/06/2022 12:51
102164423/06/2022 13:18
1113010323/06/2022 13:39
121207523/06/2022 14:28
131212023/06/2022 14:30
141211023/06/2022 17:01
15121523/06/2022 18:30
168642423/06/2022 18:55
178643023/06/2022 18:55
182164623/06/2022 18:56
191211023/06/2022 19:01
201213023/06/2022 22:30
211213024/06/2022 00:12
221213024/06/2022 00:18
231211027/06/2022 10:00
24121527/06/2022 15:30
25
Data


Fluff.xlsm
ABCD
1Date to check upGood parts with ID 121 between 06.00 -14.59
223/06/202235
3Write any date ex. 2022-06-23Return sum of good parts in that timeframe
4
5Good parts with ID 121 between 15.00 -00:15
685
7Return sum of good parts in that timeframe
8
9
10Here i'm looking for the good parts deliverd until a certain time. Now()Good parts with ID 121 between 06.00 -14.59
1110
12Return sum of good parts in that timeframe
13
14Time and date nowGood parts with ID 121 between 15.00 -00:15
1527/06/2022 15:145
16Actual date nowReturn sum of good parts in that timeframe
Main
Cell Formulas
RangeFormula
D2D2=SUMIFS(Data!B:B,Data!A:A,121,Data!D:D,">="&B2+TIME(6,0,0),Data!D:D,"<="&B2+TIME(14,59,0))
D6D6=SUMIFS(Data!B:B,Data!A:A,121,Data!D:D,">="&B2+TIME(15,0,0),Data!D:D,"<="&B2+1+TIME(0,15,0))
B15B15=NOW()


But like etaf I don't understand the 2nd part
 
Upvote 0
to use NOW , you need to change the data to use todays date

Do you want them to use a date in a cell - BUT take the time as off NOW() ?????
OR will it be using todays date anyway

I only ask - because NOW() returns todays date and time now
so if you use just
NOW()
that would search for everything say greater than NOW
BUT if you wanted them to put a date into a cell , but add the TIME NOW to it - thats a different formula
to get JUST the time now without a date - would be NOW() - TRUNC(now())
so you could use
b33 with the date of the 23rd in but add the time NOW

I dont se ehow that will help with real time and would think you just need NOW()

so 06:00 upto the time NOW
=SUMIFS(B2:B24,A2:A24,121,D2:D24,">="&TODAY()+TIME(6,0,0),D2:D24,"<="&NOW())
and
NOW upto 00:15 next day
=SUMIFS(B2:B24,A2:A24,121,D2:D24,">="&NOW(),D2:D24,"<="&INT(TODAY())+1+TIME(0,15,0))
although that will produce errors if used before 06:00 and after midnight

BUT just wondered is that what you mean -

otherwise CLEAR description of what you need

dates changed to today - so you may need to work out the numbers when you copy into the sheet as its using NOW()

Book1
ABCDE
1IDGood_partsTime
2121306/22/22 6:05
3216466/22/22 7:56
4864246/22/22 9:55
5864306/22/22 11:35
6121226/22/22 14:30
7121106/27/22 8:307/1/22 8:30
812156/27/22 10:307/1/22 10:30
9130456/27/22 12:517/1/22 12:51
10216446/27/22 13:187/1/22 13:18
111301036/27/22 13:397/1/22 13:39
12120756/27/22 14:287/1/22 14:28
13121206/27/22 14:307/1/22 14:30
14121106/27/22 17:017/1/22 17:01
1512156/27/22 18:307/1/22 18:30
16864246/27/22 18:557/1/22 18:55
17864306/27/22 18:557/1/22 18:55
18216466/27/22 18:567/1/22 18:56
19121106/27/22 19:017/1/22 19:01
20121306/27/22 22:307/1/22 22:30
21121306/28/22 0:12
22121306/28/22 0:18
23121106/27/22 10:00
2412156/27/22 15:30
25
26
27
28
29
30Sheet 2 below
31
32Date to check upGood parts with ID 121 between 06.00 -14.59
336/27/22 0:003545
34Write any date ex. 2022-06-23Return sum of good parts in that timeframe
35
36Good parts with ID 121 between 15.00 -00:15
378590
38Return sum of good parts in that timeframe
39
40
41Here i'm looking for the good parts deliverd until a certain time. Now()Good parts with ID 121 between 06.00 -14.59
421050
43Return sum of good parts in that timeframe
44
45Time and date nowGood parts with ID 121 between 15.00 -00:15
466/27/22 16:12585
47Actual date nowReturn sum of good parts in that timeframe
48
Sheet2
Cell Formulas
RangeFormula
E7:E20E7=D7+4
E33E33=SUMIFS(B2:B24,A2:A24,121,D2:D24,">="&B33+TIME(6,0,0),D2:D24,"<="&B33+TIME(14,59,0))
E37E37=SUMIFS(B2:B24,A2:A24,121,D2:D24,">="&INT(B33)+TIME(15,0,0),D2:D24,"<="&INT(B33)+1+TIME(0,15,0))
E42E42=SUMIFS(B2:B24,A2:A24,121,D2:D24,">="&TODAY()+TIME(6,0,0),D2:D24,"<="&NOW())
B46B46=NOW()
E46E46=SUMIFS(B2:B24,A2:A24,121,D2:D24,">="&NOW(),D2:D24,"<="&INT(TODAY())+1+TIME(0,15,0))
 
Upvote 0
Sometimes I want to search for a date and see the results for that day divided by the two different time frames. That Works now! Thank you so much Fluff and etaf!
Fluff formula did the work!

secondly I wanted to see the sum for the current day and of course that works fine too. Then I just use the same formulas... Thank you for all the help!
 
Upvote 0
you are welcome
glad its all resolved now
 
Upvote 0

Forum statistics

Threads
1,214,625
Messages
6,120,598
Members
448,973
Latest member
ksonnia

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