Hi I need help with a formula to calculate the day number in a year - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
James HarbuttJames Harbutt 

Hi I need help with a formula to calculate the day number in a year

I need help with a formula to calculate the day number in a year,  e.g. 5th January would return 5, 1st Feb would be 32. 

I need this to display a Users daily target.   

Also would this work by also based on working days in year.

Many thanks for any help.
Aaron DeRanAaron DeRan
365 - (365 - TODAY())

The above formula would take the days remaining in the year and subtract them from the days in a year. Granted it cannot compensate for a leap year and considers all days, not just work days.
James HarbuttJames Harbutt
Thank you, i'm getting the following Syntax error:  Error: Incorrect parameter for operator '-'. Expected Number, received Date

I have the field set as a number Field. ?
Aaron DeRanAaron DeRan
Sorry! Knee-jerk post and did not actually test it.

Here you go (tested):

365 - (DATEVALUE(TEXT(YEAR(Today())) + "-12-31") - TODAY())
Steve MolisSteve Molis
Here's one that I use: 

Field:  Day of the Year 
Datatype:  Formula 
Result Type:  Number, 0 decimals 
Formula:  TODAY() - DATE(YEAR( TODAY() ), 1, 1) + 1
James HarbuttJames Harbutt
Thank you all, that was very helpful.  Would anyone know how to do this on working days?
Aaron DeRanAaron DeRan
Check the last post on this question below and see if you can incorporate it to make it work:

http://success.salesforce.com/questionDetail?qId=a1X30000000Hk1LEAS