Share in Facebook


18 March 2018

Year Month Day Function in Excel


Friends,

The usual date format is DD-MM-YYYY or MM-DD-YYYY in Excel (Depending upon the Regional Settings in your PC) but while preparing data to be analyzed we may need some more information from the date provided.

For example, given a range of dates in the format DD-MM-YYYY  (22-07-2017) we may need to get the number of month or the year in the next column, today we'll discuss how to separate the Day or the Year or the Month ?



There are three built in functions in Microsoft Excel - Day(), MONTH() & YEAR().


Today we'll know how to use these functions in Excel with few examples. These functions are very useful and are very small and also very easy to remember.

How to use Day function in Excel ?




Syntax

The syntax for the DAY function in Microsoft Excel is

=DAY(date_value)

Parameters or Arguments

date_value : A valid date to return the day.

Returns

The DAY function returns a numeric value between 1 and 31.

How to use Month function in Excel ?

Syntax

The syntax for the MONTH function in Microsoft Excel is

=MONTH(date_value)

Parameters or Arguments

date_value : A valid date to return the month.

Returns

The MONTH function returns a numeric value between 1 and 12.

How to use Year function in Excel ?

Syntax

The syntax for the YEAR function in Microsoft Excel is

=YEAR(date_value)

Parameters or Arguments

date_value : A valid date to return the month.

Returns

The YEAR function returns a numeric value between 1999 and 9999.

So, that was the easy part, as example you can watch the picture below.

Day Month Year Function
Day Month Year Function


Now if you make a little tweak in the above functions it can show you the immense power of these functions. Lets' discuss it with some example.

Suppose you need the month from a date given as 22-08-2017, if you use MONTH function you will get the output as '8', but you need 'August' to be printed here. How to do it ?

Option 1 : Use IF function, like =if(month(A1)=1, "Jan",if(month(A1)=,"Feb",....,"Do something")

This is tedious but it will work.

Option 2 : There is another FUNCTION (TEXT())to make this job very easy which I will discuss in my blog.

Till then...

Keep reading and keep growing your knowledge in Excel...

Thank you for reading...

No comments: