mohammad Ilyas
mohammad Ilyas

Reputation: 5

Datevalue in excel

can I set my own datevalue (I mean the return value is not from 01/01/1900) in excel formula or vba.? for example: 01/01/2019 is 001 or #1 then 02/01/2019 go for 002 or #2 till end of the year 2019. from the beginning of the next year 2020 it will reset to 001 or #1. thanks in advance.

Upvotes: 0

Views: 63

Answers (1)

Gary's Student
Gary's Student

Reputation: 96753

Try:

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

with proper formatting; or if A1 contained a date in standard Excel, in another cell:

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

EDIT#1:

To get the formula cell to display the proper number of leading zeros, apply a custom format of 000:

enter image description here

Upvotes: 2

Related Questions