Skip to content
Share
Explore

Decimals - comma instead of a full stop

Conversion form USA format to EU format and the other way around.

How to turn the USA number into a EU Number?

the easiest answer you find in this answer from Bill. This goes very fast and is accurate.

The complicated answer you find below. It is a complex puzzle I took on for the sake of puzzling. It has limited practical value. There is a simple solution as well, a bit lower.
Nbr Formatting
Number 1
9,456,728,100
0
9456728100
10
1258
14710
9.456.728.100
9,456,728,100.00
94,567,281
Number 2
1002.10
0.1
10
1002
4
12
14
1.002,10
1,002.10
1,002.1
Number 3
32.51
0.51
51
32
2
131
2
32,51
32.51
32.51
Number 4
456,728,100
0
456728100
9
1147
0369
456.728.100
456,728,100.00
4,567,281
Number 5
48.4
0.4
4
48
2
131
2
48,4
48.40
48.4
Number 6
123,456,789.10
0.1
10
123456789
9
1147
0369
123.456.789,10
123,456,789.10
123,456,789.1
Number 7
1000
0
1000
4
12
14
1.000
1,000.00
1,000
Number 8
800
0
800
3
11
03
800
800.00
800
Number 9
10989383933
0
10989383933
11
1369
25811
10.989.383.933
10,989,383,933.00
10,989,383,933
There are no rows in this table


SwitchIf(thisRow.input.Find('.') >= 1,
thisRow.input.Slice( -(thisRow.input.Length() - thisRow.input.Find('.')))).WithName(decimals,

thisRow.input.Slice(1,thisRow.input.Find('.')).Split('').Filter(CurrentValue.IsNumber()).Join('').WithName(mainNumber,
mainNumber.Length().Remainder(3).WithName(start,
Sequence(start,mainNumber.Length(),by: 3).WithName(rightPart,
Listcombine(1,Sequence(1,rightPart.Count()-1).ForEach(rightPart.Nth(CurrentValue) +1)).WithName(leftPart,
Sequence(1,rightPart.Count()).ForEach(mainNumber.Slice(leftPart.Nth(CurrentValue),rightPart.Nth(CurrentValue))).Filter(CurrentValue.IsNumber()).Join(".").WithName(outcome,
SwitchIf(
decimals.IsBlank(),outcome,
decimals.IsNotBlank(),
Format("{1}{2}{3}",
If(mainNumber > 3,outcome,mainNumber),
Concatenate(","),
decimals),
Concatenate(mainNumber,",",decimals))

))))))

Simple Solution:

put column on number
select decimal separate in the settings
If(thisRow.input.ContainsText(","),
thisRow.input.Split('').Filter(CurrentValue.IsNumber()).Join('').WithName(base,
base.Splice(base.Length() -1,0,'.')),
thisRow.input)

Simple Solution 2:

With the introduction of SubsituteAll() the solution is rather straightforward. You move your EU numbers (comma instead of period to indicate decimals) to USA numbers with:
thisRow.theNumber.SubstituteAll(".","").Substitute(",",".")

There are no rows in this table

Want to print your doc?
This is not the way.
Try clicking the ··· in the right corner or using a keyboard shortcut (
CtrlP
) instead.