When a user manually enters formula in a sheet in the English version of Excel and sends this document to another user who has Excel in another version, the formula is automatically translated to the language in which the document is opened.
'Formula entered in Sheet1!B1 in the English Excel version
=VLOOKUP(A1,Sheet2!$A$1:$C$150,3,FALSE)
'Formula as shown in a Dutch Excel version
=VERT.ZOEKEN(A1;Sheet2!$A$1:$C$150;3;ONWAAR)
When I programmatically add a formula, in my English version, it would look like this:
Sub AddFormula()
ThisWorkbook.Worksheets("Sheet1").Cells(1, 2).Formula = "=VLOOKUP(A1,Sheet2!$A$1:$C$150,3,FALSE)"
End Sub
If I were to run this procedure on my English Version, then save the document and send it over to a user with another language, it would be fine as the formula is in the cell and thus translated to whatever language and locale the 2nd user uses.
My question is what happens when the 2nd user runs the procedure, in the Dutch (or other language for that matter) Excel with the formula in the code written in the EN-US format. Will it be translated or will it throw an error and in case of the latter, how would I solve that and make the formula insertion language proof?
In Excel vba the .Formula requires that the formula to be inserted be in EN-USA format. This is regardless of the local settings.
Excel will then translate it into the local vernacular when putting it in the sheet.
So no matter what the local settings it will work cross languages.
VBA also has the .FormulaLocal which allows the entry of the formula in the native language. But (as far as I know) it will not work cross different local settings.
Related
When a user manually enters formula in a sheet in the English version of Excel and sends this document to another user who has Excel in another version, the formula is automatically translated to the language in which the document is opened.
'Formula entered in Sheet1!B1 in the English Excel version
=VLOOKUP(A1,Sheet2!$A$1:$C$150,3,FALSE)
'Formula as shown in a Dutch Excel version
=VERT.ZOEKEN(A1;Sheet2!$A$1:$C$150;3;ONWAAR)
When I programmatically add a formula, in my English version, it would look like this:
Sub AddFormula()
ThisWorkbook.Worksheets("Sheet1").Cells(1, 2).Formula = "=VLOOKUP(A1,Sheet2!$A$1:$C$150,3,FALSE)"
End Sub
If I were to run this procedure on my English Version, then save the document and send it over to a user with another language, it would be fine as the formula is in the cell and thus translated to whatever language and locale the 2nd user uses.
My question is what happens when the 2nd user runs the procedure, in the Dutch (or other language for that matter) Excel with the formula in the code written in the EN-US format. Will it be translated or will it throw an error and in case of the latter, how would I solve that and make the formula insertion language proof?
In Excel vba the .Formula requires that the formula to be inserted be in EN-USA format. This is regardless of the local settings.
Excel will then translate it into the local vernacular when putting it in the sheet.
So no matter what the local settings it will work cross languages.
VBA also has the .FormulaLocal which allows the entry of the formula in the native language. But (as far as I know) it will not work cross different local settings.
I got a report in excel and I'm having some trouble with a Russian PC. The formula TEXT is being used to get the month name from a date but, in the Russian PC it's not working and not given an error.
The formula is =TEXT(D7, "mmm") and the result is "mmm".
I also tried (The excel way to handle dates in different languages):
=TEXT(D7, "[$-409]mmm") and the result is "mmm".
I've tested different date functions and they all working. (Sum(), month(), changing data format, etc).
Version: Excel 365
As it works in my pc, does anyone have any idea what might be causing the error?
First - The mmm should be MMM.
Then, the fact that the PC is in Russian is a bit irrelevant. What matters is the installation language of Excel.
You may try the following
write 43319 on range A1;
then write this formula =TEXT(A1,"MMM"), using the English M and not the Cyrillic ones. Although they look quite the same, they are different.
it should return Aug as the month;
I've found a way to fix it creating a new formula in VBA and it worked great.
Press Alt+F11 (to open the VBA editor) Then Click the menu item Insert > Module In the new VBA module, enter the following:
Public Function FMT$(ByVal Value, ByVal strFormat)
FMT = VBA.Format$(Value, strFormat)
End Function
To use this, simply type =FMT(A1, "MMM") instead of =TEXT(A1, "MMM").
Credits to https://superuser.com/questions/730371/how-to-prevent-excel-to-use-the-os-regional-settings-for-date-patterns-in-formul
I use the following formula to extract the filename of a workbook to build a hyperlink with it:
=MID(CELL("filename",A1),FIND("[",CELL("filename",A1))+1,FIND("]", CELL("filename",A1))-FIND("[",CELL("filename",A1))-1)
However I personally use a Dutch version of excel, therefore I translated the "filename" manually to suit my locale. Now I have a international contact that wants to use this in a workbook as well, but in a number of different locale's.
Is there a way to extract "filename" using a formula, as to get the appropriate word for any given locale?
Supposing the string "filename" is in cell A1 then =CELL($A$1,A1) should work.
In my German Excel then I can change A1 to "dateiname" and it works also.
But =CELL("filename",A1) should work in any locale.
Of course in my German Excel it is =ZELLE("filename"; A1). But the function's name translation Excel is doing by default if the same file is opened in another locale or with another language version of Excel. The Excel file itself stores the English function names only.
So I got an OleObject excel.application... and I am exporting data from the application into excel. I am using PowerBuilder 11.5. So in the excel I got Summary fields which I program setting formulas, like aole_handle.Selection.FormulaR1C1 = "=RC[1]/RC[-1]". In my case it works well. Now I send the application to the testers that are in German. They tell me that they got this message "Error calling external property in function..." when the row reaches to set the Formula. We even tried just to read the formula from that cell, like: string ss ss = aole_handle.Selection.FormulaR1C1 and it also craches... So the question is what would be the problem... I use Microsoft Office 2010 EN, testers use the German version... if the problem is this, then how would it be it good to solve it, so the application would work independently of the office language? I have tried also:
aole_handle.Selection.FormulaR1C1("=RC[1]/RC[-1]")
aole_handle.Selection.Formula("=RC[1]/RC[-1]")
aole_handle.Selection.Formula = "=RC[1]/RC[-1]"
Excel formulae are localized when given via OLE connections, thus when you have a formula like =SUM(...) on a French localized host you would have to send =SOMME(...) and with a German host =SUMME(...) or you get an error when setting the formula.
Similarly, the R1C1 notation needs to be given as Z1S1 in German. I have no German localized Excel to check, but I would suggest to test for a formula like =ZS[1]/ZS[-1]
Yes, this is a very annoying issue when you need to deal with foreign localized host to handle different formulae depending on the language.
When opened in an English language version of Excel, the following definition for a named range works just fine:
=OFFSET('Summary Data'!$B$9,0,0,TotalStops+1,SummaryDataColumns)
However, when the same worksheet (created using an English language version of Excel) is open using a Portuguese language version of Excel the formula in the named range is changed to:
=DESLOC('Summary Data'!$B$9;0;0;TotalStops+1;SummaryDataColumns)
To my understanding "DESLOC" is the correct translation for OFFSET, but all of commas in the formula have been replaced with semi-colons. Now anytime that the named range is referred to in vba code, the code execution fails at that point.
Just for reference, the call that references the named range is of the form:
thisworkbook.Names("dbSummaryData").RefersToRange
This link may provide a better explanation, Find the current user language
You should be able to put a check into your VBA code on what language is selected and if its other than English it will swap semi-colon for comma then execute.