Consulting

Results 1 to 6 of 6

Thread: Formula to Show Julian Date

  1. #1
    VBAX Regular rrtts's Avatar
    Joined
    Sep 2006
    Posts
    61
    Location

    Formula to Show Julian Date

    I use the following formula to provide the Julian Date:
    [VBA]=TODAY()-DATE(YEAR(TODAY()),1,0)[/VBA]

    So, for today...it results in 341.

    I'm trying to modify it to show 341 / 342.

    I tried doing this...

    [VBA]
    =TODAY()-DATE(YEAR(TODAY()),1,0) & " / " & TODAY()-DATE(YEAR(TODAY()),1,0)+1
    [/VBA]

    Which gives me 341 / 342 but it replaces the formula in the cell with these values...I want the formula to remain so it will update whenever I open the sheet.

    I'm sure I'm doing something wrong...anybody have an idea?

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Quote Originally Posted by rrtts
    but it replaces the formula in the cell with these values
    What do you mean by this?
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    VBAX Regular rrtts's Avatar
    Joined
    Sep 2006
    Posts
    61
    Location
    When I put this in the formula bar

    [VBA]
    =TODAY()-DATE(YEAR(TODAY()),1,0) & " / " & TODAY()-DATE(YEAR(TODAY()),1,0)+1
    [/VBA]

    As soon as I hit the enter key the cell displays 341 / 342

    And if you click the cell...thats what shows in the formula bar...the formula is gone. Hope that helps clear it up.

  4. #4
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    It clarifies your problem, but I don't understand it. Does it do the same for eg =A1+B1? This "functionality" could be achieved by code. Is there anything in the Worksheet or Workbook module that could cause this? Can you post the workbook?
    Regards
    MD
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  5. #5
    VBAX Regular rrtts's Avatar
    Joined
    Sep 2006
    Posts
    61
    Location
    Weird...

    In a blank worksheet (which I should've tried before posting...doh!)

    This works...

    [VBA]
    =TODAY()-DATE(YEAR(TODAY()),1,0)&" / "&TODAY()-DATE(YEAR(TODAY()),1,0)+1
    [/VBA]

    But when I post in my project...it switches as mentioned in my initial post...It has to be some kind of setting or something...

  6. #6
    Administrator
    2nd VP-Knowledge Base VBAX Master malik641's Avatar
    Joined
    Jul 2005
    Location
    Florida baby!
    Posts
    1,533
    Location
    Could you post the workbook?




    New to the forum? Check out our Introductions section to get to know some of the members here. Feel free to tell us a little about yourself as well.

Posting Permissions

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