Share via

TEXT() function sensitivity to separators

Anonymous
2023-09-28T13:58:48+00:00

I have a formula that I would like to be sensitive to the decimal and thousands separators. A simple such formula looks something like this in English:

="The result is " & TEXT(A17, "#,##0")

Now, I'm adding localization, courtesy of some custom LAMBDA functions I wrote. The same formula looks something like this:

=GetLocaleString(RESULT_IS) & TEXT(A17, GetLocaleString(INTEGER_FORMAT))

The strings associated with RESULT_IS and INTEGER_FORMAT vary from language to language.

I would prefer not to have to figure out the format for each and every language, especially when there are variations within languages. What I would really like is a format that is sensitive to the separators that Excel is using, whether they come from the system or are overridden in "Options | Advanced". For the life of me, I can't find anything like that. Does such a format exist?

Microsoft 365 and Office | Excel | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

6 answers

Sort by: Most helpful
  1. Anonymous
    2023-09-28T23:47:25+00:00

    Does the worksheet function =NUMBERVALUE ( ) help?

    Converts text to a number, in a locale-independent way.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2023-09-28T15:11:39+00:00

    That's one of those VBA functions that should really be available at the formula level. 😎 LAMBDA functions are great, but the inability to query the environment is a problem for localization.

    Thanks for your time.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2023-09-28T15:00:58+00:00

    Macro can get list separator in system. But I haven't found a way to get it using formula.

    =======================

    Application.International(xlListSeparator)

    =======================

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2023-09-28T14:40:10+00:00

    It's a start, but as you say it applies only to "." and ",", when there could be " " as well. I'll assume, based on your reply, that there's no truly generic solution.

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2023-09-28T14:30:40+00:00

    You may try this one. It only works for "." and "," as list separator.

    ="The result is " & TEXT(A17, "#"&IF(MID(1/10,2,1)=".",",",".")&"##0")

    Was this answer helpful?

    0 comments No comments