ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Date Functions (https://www.excelbanter.com/excel-worksheet-functions/451402-date-functions.html)

ahmed[_4_]

Date Functions
 
Hi,

I need unique number to identify each month in the calendar system.

The formula
'=VALUE(RIGHT(YEAR(DATEVALUE("1-04-2016")),2)&"0"&MONTH(DATEVALUE("1-04-2016")))'returns
the number I wanted for the current month.

This there any better way of doing this?

TIA
Ahmed

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus


Claus Busch

Date Functions
 
Hi Ahmed,

Am Thu, 21 Apr 2016 12:40:45 +0530 schrieb ahmed:

'=VALUE(RIGHT(YEAR(DATEVALUE("1-04-2016")),2)&"0"&MONTH(DATEVALUE("1-04-2016")))'returns
the number I wanted for the current month.

This there any better way of doing this?


try:

=--(TEXT(DATEVALUE("1-04-2016"),"yy")&TEXT(DATEVALUE("1-04-2016"),"MM"))


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional

Claus Busch

Date Functions
 
Hi Ahmed,

Am Thu, 21 Apr 2016 09:31:26 +0200 schrieb Claus Busch:

=--(TEXT(DATEVALUE("1-04-2016"),"yy")&TEXT(DATEVALUE("1-04-2016"),"MM"))


for me also works:
=--(TEXT("1-04-2016","yy")&TEXT("1-04-2016","MM"))


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional

Claus Busch

Date Functions
 
Hi again,

Am Thu, 21 Apr 2016 09:39:10 +0200 schrieb Claus Busch:

=--(TEXT(DATEVALUE("1-04-2016"),"yy")&TEXT(DATEVALUE("1-04-2016"),"MM"))


for me also works:
=--(TEXT("1-04-2016","yy")&TEXT("1-04-2016","MM"))


you also can enter a correct date and format it custom
YYMM


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional

ahmed[_4_]

Date Functions
 
On 21/04/2016 01:28 PM, Claus Busch wrote:
Hi again,

Am Thu, 21 Apr 2016 09:39:10 +0200 schrieb Claus Busch:

=--(TEXT(DATEVALUE("1-04-2016"),"yy")&TEXT(DATEVALUE("1-04-2016"),"MM"))


for me also works:
=--(TEXT("1-04-2016","yy")&TEXT("1-04-2016","MM"))


you also can enter a correct date and format it custom
YYMM


Regards
Claus B.


Both the formulas work fine.
Thank you, Claus.

Kind Regards,
Ahmed.

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus



All times are GMT +1. The time now is 10:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com