+ Reply to Thread
Results 1 to 9 of 9

Calculating Corrected Time Based on Time Zone

  1. #1
    Registered User
    Join Date
    07-27-2009
    Location
    Scranton, Pennsylvania
    MS-Off Ver
    Office 365
    Posts
    31

    Calculating Corrected Time Based on Time Zone

    Hey everyone, could you please help with the following?

    In the attached example, I have some incidents that occurred on a specific date and time. The time/date stamp is in Pacific Time. Is there a formula that we could write that would say if the time zone identifier is "eastern" (in adjacent column), then add 3 hours to the time/date to get the "corrected date and time". If the time zone is central, then add 2 hours, if Hawaii -3, etc....

    In my mind, it would be a combination of an "If" statement along with the "time" function but I'm sure someone knows this faster than I can figure it out.

    Thanks for your help.
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    12,996

    Re: Calculating Corrected Time Based on Time Zone

    Using a helper column (K). Enter correction hours as fractions of a day. Name the cells corresponding to each zone. Use
    Please Login or Register  to view this content.
    in column D.
    Attached Files Attached Files
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    07-27-2009
    Location
    Scranton, Pennsylvania
    MS-Off Ver
    Office 365
    Posts
    31

    Re: Calculating Corrected Time Based on Time Zone

    Thanks for responding but I have to be honest, i have absolutely no idea how the fractional part factors into this. I have over 10K rows of data that I'm going to have to calculate. Will this work for that?
    Last edited by Falk781; 05-29-2020 at 10:28 PM.

  4. #4
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,676

    Re: Calculating Corrected Time Based on Time Zone

    In D2 like this:

    =B2+IF(C2="West",0,IF(C2="Central",2,IF(C2="East",3,IF(C2="Hawaii",-3, IF(.....))))
    Quang PT

  5. #5
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    12,996

    Re: Calculating Corrected Time Based on Time Zone

    In cell B2, you have a date:
    5/26/20 13:00
    but this date is actually stored in Excel as a decimal number:
    43977.54167
    The integer part is the number of days since 1/1/1900 and the decimal part is the fraction of the 24 hour day elapsed since 12:00AM
    therefore whole numbers are DAYS, fractions are hours. One hour is 1/24 of a day, etc.

    Notice that in your original attachment, the "corrected" values have the wrong date!

    If you prefer the IF() formulas the you must correct it:

    Please Login or Register  to view this content.
    I used named cells in my attached workbook to make the formula simpler, all you had to do was drag it down...
    Last edited by protonLeah; 05-30-2020 at 02:45 AM.

  6. #6
    Registered User
    Join Date
    07-27-2009
    Location
    Scranton, Pennsylvania
    MS-Off Ver
    Office 365
    Posts
    31

    Re: Calculating Corrected Time Based on Time Zone

    Leah thanks - I notice that if you run the formula without the fraction as in Bebo's example, it actually ramps up the date, but not the time. Also thanks for the mention on the example date mismatch. I'm assuming that the fraction of a day x/24 is exclusive to dates and that's why the If statement recognizes it? I'm just trying to figure out how it realizes not to update the date, only the associated time?

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,864

    Re: Calculating Corrected Time Based on Time Zone

    A day is 24 hours, so if you add 3 divided by 24 to a time, it gives you a 3-hour increase. If you just added 3, it would be three whole days.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  8. #8
    Registered User
    Join Date
    07-27-2009
    Location
    Scranton, Pennsylvania
    MS-Off Ver
    Office 365
    Posts
    31

    Re: Calculating Corrected Time Based on Time Zone

    Thanks for your help everyone - I really appreciate it.

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,864

    Re: Calculating Corrected Time Based on Time Zone

    No problem.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to convert from indian time zone to US time zone
    By prabhuduraraj09 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-18-2018, 05:42 AM
  2. [SOLVED] Calculating a previous work shift time (05:30, or 17:30) based on current time
    By andrew.why in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-20-2017, 09:09 PM
  3. Input: Time Zone. Output: Current Time
    By imsteve123 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-09-2015, 09:16 PM
  4. Need Help with an user form that convert GTM Time to Other selected Time Zone
    By odoualex in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-08-2014, 11:52 AM
  5. Replies: 7
    Last Post: 02-14-2012, 06:07 PM
  6. Calculating END time based on start time, breaks, and hours to complete
    By sweedey in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-01-2012, 11:29 AM
  7. sorting by time zone based on zip codes
    By rooshio in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-11-2009, 07:57 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1