Using Date Ranges in a table for a query

Mark44stfc

New Member
Joined
Feb 18, 2013
Messages
37
I am currently building a reporting database. The data that is in there will be global but time stamps on the reporting data itself is GMT.

I therefore have to convert, also bearing in mind that clock changes happen at different times I have created a Table which is as follows

Country|Start Date|End Date|OffsetFromGMT

USA|13/03/2016 06:00 | 06/11/2016 07:00 | -04:00
USA|06/11/2016 07:00 | 12/03/2017 06:00 | -05:00

I can then build this table out for 10 years to futureproof my date time conversion

My question, is how to use this type of data in a query to convert a column? or is there a better way of achieving this?

Any heklp is greatly appreciated....
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Use a query.
the query applies the GMT to both time so both fields read as GMT.
Use that query as the basis of all date queries.

DateAdd("h",[OffsetGmt],[StartDate])
 
Last edited:
Upvote 0
Use a query.
the query applies the GMT to both time so both fields read as GMT.
Use that query as the basis of all date queries.

DateAdd("h",[OffsetGmt],[StartDate])


Thanks for this, I have looked up the DateAdd function and that definiteely seems to be the way but I cannot seem to get it to work.

My conversion table has various differing conversions dependant on the date. The full table is below.

How do i then convert whereby the query will look at where the current OrgUK date sits in this table and add or subtract as appropriate


ParentOrgNameStart DateEnd DateOffsetFromVerintGMT
Org UK01/01/2016 00:0027/03/2016 01:0000:00
Org UK27/03/2016 01:0030/10/2016 02:00+01:00
Org UK30/10/2016 02:0026/03/2017 01:0000:00
Org UK26/03/2017 01:0029/10/2017 02:00+01:00
Org UK29/10/2017 02:0025/03/2018 01:0000:00
Org UK25/03/2018 01:0028/10/2018 02:00+01:00
Org UK28/10/2018 02:0031/03/2019 01:0000:00
Org UK31/03/2019 01:0027/10/2019 02:00+01:00
Org UK FO01/01/2016 00:0027/03/2016 01:0000:00
Org UK FO27/03/2016 01:0030/10/2016 02:00+01:00
Org UK FO30/10/2016 02:0026/03/2017 01:0000:00
Org UK FO26/03/2017 01:0029/10/2017 02:00+01:00
Org UK FO29/10/2017 02:0025/03/2018 01:0000:00
Org UK FO25/03/2018 01:0028/10/2018 02:00+01:00
Org UK FO28/10/2018 02:0031/03/2019 01:0000:00
Org UK FO31/03/2019 01:0027/10/2019 02:00+01:00
Org USA01/01/2016 00:0013/03/2016 06:00-05:00
Org USA13/03/2016 06:0006/11/2016 07:00-04:00
Org USA06/11/2016 07:0012/03/2017 06:00-05:00
Org USA12/03/2017 06:0005/11/2017 07:00-04:00
Org USA05/11/2017 07:0011/03/2018 06:00-05:00
Org USA11/03/2018 06:0004/11/2018 07:00-04:00
Org USA04/11/2018 07:0010/03/2019 06:00-05:00
Org USA10/03/2019 06:0003/11/2019 07:00-04:00
Org USA FO01/01/2016 00:0013/03/2016 06:00-05:00
Org USA FO13/03/2016 06:0006/11/2016 07:00-04:00
Org USA FO06/11/2016 07:0012/03/2017 06:00-05:00
Org USA FO12/03/2017 06:0005/11/2017 07:00-04:00
Org USA FO05/11/2017 07:0011/03/2018 06:00-05:00
Org USA FO11/03/2018 06:0004/11/2018 07:00-04:00
Org USA FO04/11/2018 07:0010/03/2019 06:00-05:00
Org USA FO10/03/2019 06:0003/11/2019 07:00-04:00
<colgroup><col width="108" style="width: 81pt; mso-width-source: userset; mso-width-alt: 3949;"> <col width="111" style="width: 83pt; mso-width-source: userset; mso-width-alt: 4059;" span="2"> <col width="147" style="width: 110pt; mso-width-source: userset; mso-width-alt: 5376;"> <tbody> </tbody>
 
Upvote 0

Forum statistics

Threads
1,221,700
Messages
6,161,371
Members
451,700
Latest member
Eccymarge

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