Share
Explore

# Decimals - comma instead of a full stopDecimals - 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
0
Name
input
decimalsAlternative
i
decimals
i
mainNumber
theLength
i
leftPart
rightPart
i
output
backToUSAFomat
simpleSolution
1
Number 1
9,456,728,100
0
9456728100
10
1258
14710
9.456.728.100
9,456,728,100.00
94,567,281
2
Number 2
1002.10
0.1
10
1002
4
12
14
1.002,10
1,002.10
1,002.1
3
Number 3
32.51
0.51
51
32
2
131
2
32,51
32.51
32.51
4
Number 4
456,728,100
0
456728100
9
1147
0369
456.728.100
456,728,100.00
4,567,281
5
Number 5
48.4
0.4
4
48
2
131
2
48,4
48.40
48.4
6
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
7
Number 7
1000
0
1000
4
12
14
1.000
1,000.00
1,000
8
Number 8
800
0
800
3
11
03
800
800.00
800
9
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(",",".")

Name
theNumber
substitute
substituteAll
solution
1
Number 1
1.000.000.000,00
1000.000.000,00
1000000000,00
1,000,000,000
2
Number 2
234.567.890,12
234567.890,12
234567890,12
234,567,890.12
3
Number 3
876.543.210,34
876543.210,34
876543210,34
876,543,210.34
4
Number 4
456.789.123,45
456789.123,45
456789123,45
456,789,123.45
5
Number 5
123.456.789,56
123456.789,56
123456789,56
123,456,789.56
6
Number 6
987.654.321,67
987654.321,67
987654321,67
987,654,321.67
7
Number 7
654.321.987,78
654321.987,78
654321987,78
654,321,987.78
8
Number 8
321.987.654,89
321987.654,89
321987654,89
321,987,654.89
9
Number 9
789.123.456,90
789123.456,90
789123456,90
789,123,456.9
10
Number 10
567.890.123,01
567890.123,01
567890123,01
567,890,123.01
11
Number 11
345.678.912,23
345678.912,23
345678912,23
345,678,912.23
12
Number 12
912.345.678,34
912345.678,34
912345678,34
912,345,678.34
13
Number 13
678.912.345,45
678912.345,45
678912345,45
678,912,345.45
14
Number 14
432.109.876,56
432109.876,56
432109876,56
432,109,876.56
15
Number 15
210.987.654,67
210987.654,67
210987654,67
210,987,654.67
16
Number 16
109.876.543,78
109876.543,78
109876543,78
109,876,543.78
17
Number 17
543.210.987,89
543210.987,89
543210987,89
543,210,987.89
18
Number 18
768.543.210,90
768543.210,90
768543210,90
768,543,210.9
19
Number 19
890.123.456,01
890123.456,01
890123456,01
890,123,456.01
20
Number 20
102.345.678,12
102345.678,12
102345678,12
102,345,678.12
There are no rows in this table