Solved

Day of year in excel

Posted on 2015-02-11
9
70 Views
Last Modified: 2015-02-12
Column A has a list of dates in the format:  5/8/2014  11:23:29 AM.

I would like Column B to have which day of the year it is (1 through 365).

Any idea how to make this happen? THanks!
0
Comment
Question by:cansevin
9 Comments
 
LVL 46

Expert Comment

by:Martin Liss
ID: 40604309
format the target cell as a Number and then assuming the date is in A1

=A1-DATE(YEAR(A1),1,0)
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 40604312
So format column B as Number (no decimals) , put the formula in B1, and copy down.
0
 
LVL 11

Expert Comment

by:Wilder1626
ID: 40604355
Hi

And if by any chance you need the number of days remaining in the year:

=DATE(YEAR(A1),12,31)-A1
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 50

Accepted Solution

by:
barry houdini earned 500 total points
ID: 40604475
If your date column also contains times as you say....and you want an integer returned then you probably need to add an INT function to Martin's suggested formula, i.e.

=INT(A1)-DATE(YEAR(A1),1,0)

regards, barry
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 40604491
If your date column also contains times as you say....and you want an integer returned then you probably need to add an INT function to Martin's suggested formula
No need to do that if the destination cell is defined as a Number with no decimals as I suggested above.
0
 
LVL 50

Expert Comment

by:barry houdini
ID: 40604700
Hey Martin!

....but using your method would mean that the underlying value would still include the decimals, so that might be an issue if used in further calculations.....but also even the display could be wrong, I think.

I'm assuming that if the date is 1st January then cansevin would want to display just 1, whatever the time, for the first day of the year, but if the time is after noon then the result, using your method, will be 2, e.g. if the A1 entry is something like:

1/1/2015  4:25:00 PM

regards, barry
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 40604705
I stand corrected. INT should be used.
0
 

Author Closing Comment

by:cansevin
ID: 40607127
Thanks guys! INT was the way to go. Without it and no decimals, it would round to the next day if the time was after noon. Thanks for the help!
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 40607135
@cansevin: Did you consider giving me part of the points?
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
stuck in average-1 12 65
Text box keydown event does not work 38 41
A Table within a User Form 24 44
Consolidation of Worksheet into a final worksheet 4 40
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question