+ Reply to Thread
Results 1 to 24 of 24

Updating time in realtime based on city in preceding cell

  1. #1
    Registered User
    Join Date
    03-06-2004
    Posts
    53

    Updating time in realtime based on city in preceding cell

    I am kind of novice in Excel and designing a spreadsheet for my employer. This is what i am trying to do. First, i am trying to figure out, how to automatically update time, based on specific city's time zone? Lets say, if the city is dallas, time zone is Central GMT-6. In the next cell, the time shows up as Dallas's local time, instead of local computer time. And this time updates itself after every 2 min.

    2ndly, if that city's time is later than 8:59 PM local time, that specific city's cell grays out.

    Any help will be highly appreciated. I am lost

    Attach: Snapshot of sheet
    Attached Images Attached Images

  2. #2
    Valued Forum Contributor JeanRage's Avatar
    Join Date
    03-02-2009
    Location
    Nice, France
    MS-Off Ver
    Excel 2003
    Posts
    705

    Re: Updating time in realtime based on city in preceding cell

    Hi,

    You can use the function =Now() and format the cell as you wish ...
    Then you can add or substract whatever hours difference, and use conditional formatting for colors ...

    HTH

  3. #3
    Registered User
    Join Date
    03-06-2004
    Posts
    53

    Re: Updating time in realtime based on city in preceding cell

    The problem is that =NOW() will not show the time in that state. I am in Texas and lets say that New York local time needs to be updated after every 2 min or so. How will a sec synchronize the time and make sure its the right time zone?

  4. #4
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Updating time in realtime based on city in preceding cell

    Use

    =NOW()-TIME(6,0,0)

    to subtract 6 hours.

    You'd need a macro to recalculate every X seconds

  5. #5
    Valued Forum Contributor JeanRage's Avatar
    Join Date
    03-02-2009
    Location
    Nice, France
    MS-Off Ver
    Excel 2003
    Posts
    705

    Re: Updating time in realtime based on city in preceding cell

    Hi,

    Attached is a sample file ...

    HTH
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    03-06-2004
    Posts
    53

    Re: Updating time in realtime based on city in preceding cell

    If state=TX, time in the next colum should change automtically to =NOW()-TIME(0,0,0), since local machine is in central time zone.

    But how to do this trick,if local machine is in Central, but the state is in Pacific and when the state abbreviation is changed, the time zone automatically recognizes the change and updates the cell accordingly.

  7. #7
    Valued Forum Contributor
    Join Date
    07-29-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003/Excel 2010
    Posts
    534

    Re: Updating time in realtime based on city in preceding cell

    Based on JeanRage's attachment. The macro was "googled", since i have no usefull knowledge of VBA. It should update NOW() every 20 seconds.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    03-06-2004
    Posts
    53

    Re: Updating time in realtime based on city in preceding cell

    WHER
    This is awesomeeeestest... but there is a sligh problem, when i try pasting state in cells, lets say i wanna paste NY, instead of Dallas, it gives an error message. Anyway possible that i can copy paste states and the time recognizes the change and updates itself?

    I really appreciate the work done. You are an extremely helpful person

  9. #9
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Updating time in realtime based on city in preceding cell

    works fine for me
    what error message? do you get
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  10. #10
    Valued Forum Contributor
    Join Date
    07-29-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003/Excel 2010
    Posts
    534

    Re: Updating time in realtime based on city in preceding cell

    The state names (like NY) that you enter in C2, C3 etc.. by copy/paste or typing or validation list, should be spelled exactly the same as the state names in the lookup table in J2, J3 etc. So: entering "NY" in C2 while the lookup table J2, J3 etc.. contains "NewYork" does not work. Therefore in my example i used J2:J5 as validation list for C2:C5.

  11. #11
    Registered User
    Join Date
    03-06-2004
    Posts
    53

    Re: Updating time in realtime based on city in preceding cell

    Attached is the shot of error
    Attached Images Attached Images

  12. #12
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Updating time in realtime based on city in preceding cell

    Look! the value that is causing the error is "New York" with a space.
    The value in your lookup table is "NewYork" without a space.

    see it?

  13. #13
    Registered User
    Join Date
    03-06-2004
    Posts
    53

    Re: Updating time in realtime based on city in preceding cell

    Kool beans, it works, you guys are awesome. one last thing though. If i want the cell to greay out after 8:59:00 PM, what do i need to do, i tried =IF(D2>8:59:00 PM,"No","Yes"), this doesn't work.



    Also the time is not updating automatically, i have attached the sheet for anyone to take a look at.
    Attached Files Attached Files

  14. #14
    Valued Forum Contributor
    Join Date
    07-29-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003/Excel 2010
    Posts
    534

    Re: Updating time in realtime based on city in preceding cell

    For the greying out try this:
    select C2, C3, etc.. down as far as needed, go to format >> conditional format >> formula is >> =TIME(HOUR(D2),MINUTE(D2),SECOND(D2))>0,874305556
    When i opened the attached workbook, the time updated ok.

  15. #15
    Registered User
    Join Date
    03-06-2004
    Posts
    53

    Re: Updating time in realtime based on city in preceding cell

    Well, time is updating fine, but cells are not graying out.

  16. #16
    Registered User
    Join Date
    03-06-2004
    Posts
    53

    Re: Updating time in realtime based on city in preceding cell

    I tried entering the formula with '=' sign and it does not accept it, without '=' sign, it accepts it, but the cells dont gray out after 8:58:00 PM . Please help me out

  17. #17
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Updating time in realtime based on city in preceding cell

    Glad to help out, but could you upload a new version of the file to show what you've done so far, and please do not protect it with a password

  18. #18
    Registered User
    Join Date
    03-06-2004
    Posts
    53

    Re: Updating time in realtime based on city in preceding cell

    Quote Originally Posted by teylyn View Post
    Glad to help out, but could you upload a new version of the file to show what you've done so far, and please do not protect it with a password
    I have attached the file
    Attached Files Attached Files
    Last edited by bholabhala; 11-30-2009 at 04:00 AM.

  19. #19
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Updating time in realtime based on city in preceding cell

    which formula did you enter where? You only have two different conditional formats in the sheet, one is

    cell value = "Waiting" = blue

    the other one is

    cell value = "called" = pink

    where would you expect anything to turn grey???? Where is your formula? Did you try out WHER's suggestion??

  20. #20
    Registered User
    Join Date
    03-06-2004
    Posts
    53

    Re: Updating time in realtime based on city in preceding cell

    I tried entering the formula, it didn't work, so i removed it ;(

  21. #21
    Valued Forum Contributor JeanRage's Avatar
    Join Date
    03-02-2009
    Location
    Nice, France
    MS-Off Ver
    Excel 2003
    Posts
    705

    Re: Updating time in realtime based on city in preceding cell

    Hi,

    Check if you do not have conflicts within your formatting conditions ...

    As far as turning cells to grey after 8:58 PM, test formula
    =(D2-INT(D2))>0.874305556
    HTH

  22. #22
    Valued Forum Contributor
    Join Date
    07-29-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003/Excel 2010
    Posts
    534

    Re: Updating time in realtime based on city in preceding cell

    Hi,
    in the attachment below your workbook with conditional formatting applied,
    in column C with JeanRages formula, in column D with the formula i provided, both work for me.
    Attached Files Attached Files

  23. #23
    Registered User
    Join Date
    03-06-2004
    Posts
    53

    Re: Updating time in realtime based on city in preceding cell

    One last question for you guys. The cells are graying out just fine after 8:58 PM. Anyway they can white out after 7:58 am. So they are supposed to remain grayed out from 8:58PM till 7:58 AM. Is it possible?


    I dont know what i would have done without you guys' help. You all are awesome

  24. #24
    Valued Forum Contributor JeanRage's Avatar
    Join Date
    03-02-2009
    Location
    Nice, France
    MS-Off Ver
    Excel 2003
    Posts
    705

    Re: Updating time in realtime based on city in preceding cell

    Hi,

    You only need to add a second condition
    =(D2-INT(D2))<0.325
    HTH

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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