Search code examples
excellocalizationexcel-formulaglobalization

Get current culture using just formula for localization purpose


Is there a way how to determine current system culture using a formula in Excel wihout using any VBA code?

I imagine something simple like this:

IF(CULTURE="sk-SK","Prehľad","Overview")

or also something like this would do for me:

IF(CURRENCYSIGN="€","Prehľad","Overview")

I am looking for a simple way to globalize XLSX file without any additional resources or files needed.


Solution

  • No, there is no way to get system language settings without VBA. There is simply no built-in function for this. But if you consider UDF, there's a solution:

    Public Function GetLang()
        GetLang = Application.LanguageSettings.LanguageID(msoLanguageIDUI)
    End Function
    

    However, with your help we have found a trick. You can guess the system language by analyzing formula text (only in Excel 2013):

    A1=TODAY()
    =IF(FORMULATEXT(A1)="=TODAY()",[some logic for English system],[some logic for non-English system])
    

    Or by analyzing local month name:

    =IF(TEXT(1,"mmmm")="January",[some logic for English system],[some logic for non-English system])