Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default TEXT(Cell1,"MMMM YYYY") to work in all locale.

You could use VBA to create the correct function:

This has not been tested with other regional formats, but works with my
Canadian settings. It's kind of awkward, but I don't know of any other
way to do this.

Sub SetFormula()

Dim strM As String
Dim strY As String
Dim strFormat As String
Dim strDQ As String

strDQ = Chr(34)

strM = Application.International(xlMonthCode)
strY = Application.International(xlYearCode)

strFormat = strM & strM & strM & strM & " " & strY & strY & strY &
strY

ActiveSheet.Range("B2").Formula = _
"=" & strDQ & "Month :- " & strDQ & _
" & TEXT($A$2, " & strDQ & strFormat & strDQ & ")"

End Sub

--
HTH,
Dianne

In ,
Kevin McCartney typed:
Hi TWIMC
The following funtion works on a computer that has "English" date
format setting each YYYY to represent a four digit year, but if view
the same workbook on a computer that has "German" settings I don't
see a four digit year I only see YYYY. The letter that represents Y
for Year in German is J for Jahr, so I know it relates to the locale.
My question is that if Excel is locale supportive in that the IF
function is translated WENN or VLOOKUP is translated to SVERWIES then
how come it does not translate text formats like MMMM YYYY and
translate them automatically to MMMM JJJJ. In any case how do I
overcome this problem.

(English settings)
="Month :- " & TEXT($A$2,"MMMM YYYY") where A2 = 01/01/2004 I would
see Month :- " January 2004"

(German settings)
="Month :- " & TEXT($A$2,"MMMM YYYY") where A2 = 01.01.2004 I would
see Month :- " Januar YYYY"

TIA
KM



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
combine text & date formula to show mmmm dd, yyyy? htm_temp1 Excel Worksheet Functions 3 December 22nd 09 05:17 AM
How to change "xxx CR" and "y,yyy DB" to "+xxx" and "-yyyy" vud i Excel Worksheet Functions 6 January 31st 09 05:37 AM
Convert text "date" (DDMMMYY) to datetime value of YYYY-MM-DD - ho j.a. harriman Excel Discussion (Misc queries) 7 March 29th 07 01:20 AM
Insert "-" in text "1234567890" to have a output like this"123-456-7890" Alwyn Excel Discussion (Misc queries) 3 October 25th 05 11:36 PM
TEXT(Cell1,"MMMM YYYY") to work in all locale. arno Excel Programming 0 February 10th 04 07:35 AM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"