+ Reply to Thread
Results 1 to 6 of 6

Day in year

  1. #1
    Registered User
    Join Date
    09-30-2011
    Location
    Hull,UK
    MS-Off Ver
    Excel 2010
    Posts
    7

    Exclamation Day in year

    Is there a function in excel where i could get the day in year( out of 365) from the month in the year and day in month?

    so if today was month=9 and day =30 then output day in year =273

    or is there a way I can have a cell which automatically updates the day in year value.

    The month and day in month values are calculated separately using the =NOW()


    Many Thanks for any help

    Matt

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Day in year

    It's easier to do that directly using TODAY() function

    =TODAY()-DATE(YEAR(TODAY()),1,0)

    format result cell as general
    Audere est facere

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2406 Win 11 Home 64 Bit
    Posts
    24,026

    Re: Day in year

    My suggestion is to use the DateDif function.

    http://www.techonthenet.com/excel/formulas/datedif.php

    Compare the date in question to the first day of the year.

    Alan
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  4. #4
    Registered User
    Join Date
    09-30-2011
    Location
    Hull,UK
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Day in year

    I added :

    =TODAY()-DATE(YEAR(TODAY()),1,0)

    into my sheet and it works the result is 273 days.

    Will this update everyday by itself? We are running a programme with output and the day in month and month generate when the sheet is opened , will this day in year value do the same?

    I don't know how it works but it works and you have been a great help!

  5. #5
    Registered User
    Join Date
    09-30-2011
    Location
    Hull,UK
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Day in year

    so the calculation looks at the difference from the 31st Dec 2010 to Today which is obviously the year day!

  6. #6
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Day in year

    That's right. This formula gives you 1st January in the current year

    =DATE(YEAR(TODAY()),1,1)

    but notice that I used zero in place of the last 1.....which gives you the day before, i.e. last day of last year, possibly more transparent would be

    =DATE(YEAR(TODAY())-1,12,31)

    and, of course it will update every day as long as you re-open or re-calculate the sheet.

    Alan's suggestion is similar but you don't really need DATEDIF to get a difference in days - you can just subtract as with my suggestion

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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