With the date "June 1, 2016" in cell B4, the formula returns 153, since June 1st is the 153rd day of that year.
This formula takes advantage of the fact that dates are just sequential numbers in Excel. It determines the last day of the previous year and subtracts that value from the original date B4. The result is nth day of the year.
Note the day argument in DATE is supplied as zero. A nice feature of DATE function is it can handle DAY values that are "out of range" and adjust the result appropriately. When we give DATE a year, a 1 for month, and zero for DAY, the DATE function returns the last day of the previous year.
Day of year as of today
To adjust the formula to return the nth day of year for the current date, just use the TODAY function for the date:
The Excel DATE function creates a valid date from individual year, month, and day components. The DATE function is useful for assembling dates that need to change dynamically based on other values in a worksheet.
The Excel YEAR function returns the year component of a date as a 4-digit number. You can use the YEAR function to extract a year number from a date into a cell or to extract and feed a year value into another formula, like the...
Excel Formula Training
Formulas are the key to getting things done in Excel. In this accelerated training, you'll learn how to use formulas to manipulate text, work with dates and times, lookup values with VLOOKUP and INDEX & MATCH, count and sum with criteria, dynamically rank values, and create dynamic ranges. You'll also learn how to troubleshoot, trace errors, and fix problems. Instant access. See details here.