2
I have a lot of situations where I need to quickly insert/import numeric data into Excel. I have no personal preference for either ',' or '.' as decimal separator. However, the data I import sometimes uses one separator, and sometimes the other.
The problem is that inserting the data with the wrong separator means that Excel interprets it as strings. This in turns means that any operator that works on numbers, doesn't work on this data.
The options I considered are:
- Manually switch the ',' for '.' in the input data when needed, before importing/inserting the data into Excel. This is an error-prone approach when dealing when text as well (ensuring only the separators are swapped) and feels like a finicky hack.
- Swapping the separator Excel uses every time. This might cause problems when I have multiple sheets open at the same time.
It seems to me it should be possible to tell Excel that for a give set of cells, the strings should be parsed as numbers in a given format. Is this possible? Or are the two alternatives I mentioned above the only options?
If you use a tool with grep capability to replace only commas preceded and followed by characters [0-9], the process should be easy and reliable. Notepad++ and many other text editors can do so, and the process could be scripted, too. See https://stackoverflow.com/questions/12126597/remove-comma-from-a-digits-portion-string
– DrMoishe Pippik – 2018-04-20T01:59:03.883