How to get value using VLOOKUP from datetime range?

pete1229

New Member
Joined
Nov 6, 2020
Messages
21
Office Version
  1. 365
Platform
  1. Windows
I have 2 columns (A and B) which contains the datetime of when the data was obtained and the data value respectively. I attempted to use these columns as the vlookup table array. I want to capture the data in a 30-minute cycle (e.g. 09:00, 09:30, 10:00, 10:30 etc) and insert these values into column F.
For example, if a data was received at 09:15, its value would be returned at 09:00; if it was received at 09:59, its value would be returned at 09:30.

If more than 1 data value was received within the same 30-minute cycle, the values would be summed. For example, if two data values of 0.1 and 0.2 were received at 09:15 and 09:17, the sum value of 0.3 would be returned at 09:00.

If no data was received for any 30-minute cycle, it simply returns a zero.

The dataset I have is over a year's worth, I am open to solutions using cell equations or VBA.

Data obtainedData valueDatetimeOutputExpected output
28/07/2021 09:350.128/07/2021 09:000
29/07/2021 07:550.228/07/2021 09:300.1
29/07/2021 11:090.328/07/2021 10:000
29/07/2021 11:480.429/07/2021 10:300
29/07/2021 11:590.529/07/2021 11:000.3
30/07/2021 12:460.629/07/2021 11:300.9
30/07/2021 12:530.730/07/2021 12:000
31/07/2021 12:590.830/07/2021 12:302.1
31/07/2021 13:000.931/07/2021 13:000.9
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
how about
Book8
ABCDEFG
1Data obtainedData valueDatetimeOutputExpected output
27/28/21 9:350.17/28/21 9:0000
37/29/21 7:550.27/28/21 9:300.10.1
47/29/21 11:090.37/28/21 10:0000
57/29/21 11:480.47/29/21 10:3000
67/29/21 11:590.57/29/21 11:000.30.3
77/30/21 12:460.67/29/21 11:300.90.9
87/30/21 12:530.77/30/21 12:0000
97/31/21 12:590.87/30/21 12:301.32.1
107/31/21 13:000.97/31/21 13:000.90.9
Sheet2
Cell Formulas
RangeFormula
F2:F10F2=SUMIFS($B$2:$B$10,$A$2:$A$10,">="&E2,$A$2:$A$10,"<"&E2+TIME(0,29,59))


just need to recheck the 2.1

so
31/07/2021 12:59:00
is not in your 2nd list and not correct

changed 31 to 30th

Book8
ABCDEFG
1Data obtainedData valueDatetimeOutputExpected output
27/28/21 9:350.17/28/21 9:0000
37/29/21 7:550.27/28/21 9:300.10.1
47/29/21 11:090.37/28/21 10:0000
57/29/21 11:480.47/29/21 10:3000
67/29/21 11:590.57/29/21 11:000.30.3
77/30/21 12:460.67/29/21 11:300.90.9
87/30/21 12:530.77/30/21 12:0000
97/30/21 12:590.87/30/21 12:302.12.1
107/31/21 13:000.97/31/21 13:000.90.9
Sheet2
Cell Formulas
RangeFormula
F2:F10F2=SUMIFS($B$2:$B$10,$A$2:$A$10,">="&E2,$A$2:$A$10,"<"&E2+TIME(0,29,59))
 
Upvote 0
Solution
Apologies, the date for the 2.1 output value was indeed incorrect.
Your answer is exactly what I need, absolutely perfect!
Thank you!
 
Upvote 0

Forum statistics

Threads
1,214,599
Messages
6,120,448
Members
448,966
Latest member
DannyC96

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