ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Month to Number format (https://www.excelbanter.com/excel-programming/402712-month-number-format.html)

manfareed

Month to Number format
 
Hi ,

I need to extract November as "11" from November 2007. But this can change
depending on the current month eg. "12" from December 2007.

"11" should be in number format so that it can be used in calculations to
calculate average costs.

Thanks,

sebastienm

Month to Number format
 
Hi,
Not sure I understand it...
Say you have a full/partial date in A1
Anywhere else on the sheet, use =Month(A1) to return the month number. eg:
= IF ( Month(A1) = 11, ..., ... )

--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"manfareed" wrote:

Hi ,

I need to extract November as "11" from November 2007. But this can change
depending on the current month eg. "12" from December 2007.

"11" should be in number format so that it can be used in calculations to
calculate average costs.

Thanks,


[email protected]

Month to Number format
 
On Dec 13, 11:40 am, manfareed
wrote:
Hi ,

I need to extract November as "11" from November 2007. But this can change
depending on the current month eg. "12" from December 2007.

"11" should be in number format so that it can be used in calculations to
calculate average costs.

Thanks,


Just use the Month() function...

Private Sub test()
Dim s As String, n As Integer
s = "November 2007"

n = Month(s)

End Sub

manfareed

Month to Number format
 
Hi Thank you both. That works perfectly.

"manfareed" wrote:

Hi ,

I need to extract November as "11" from November 2007. But this can change
depending on the current month eg. "12" from December 2007.

"11" should be in number format so that it can be used in calculations to
calculate average costs.

Thanks,



All times are GMT +1. The time now is 10:33 AM.

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