Hi @aqidahadiqa ,
Could you tell me:
- Whether the input number has two decimal places, the result will be kept one decimal place? (For example: 5.73→5.7 , 5.75→5.8, 5.76→5.8, 5.85→5.8)
- Whether the input number has three decimal places, the result will retain two decimal places? (For example: 5.73→5.7 , 5.75→5.8, 5.76→5.8, 5.85→5.8)
- Do you have any other needs? For example, other decimal places? How many digits should they keep?
I modified the formula and the formula can satisfy the condition 1 and condition 2 mentioned above.
In addition, when the number does not belong to Condition 1 or Condition 2, the digital output is equal to the input.
You can refer to the following formula:
1\ Set button’s onselect property to:
Set(Var,***) //*** is a number
2\ Set label’s Text property to:
If(
Len(
Mid(
Text(Var),
Find(
".",
Text(Var)
) + 1,
8
)
) = 3,
If(
RoundDown(
Mod(
Var * 1000,
10
),
0
) = 5 && Mod(
RoundDown(
Var,
2
) * 100,
2
) = 0,
RoundDown(
Var,
2
),
RoundDown(
Mod(
Var * 1000,
10
),
0
) = 5 && Mod(
RoundDown(
Var,
2
) * 100,
2
) = 1,
RoundUp(
Var,
2
),
Round(
Var,
2
)
),
Len(
Mid(
Text(Var),
Find(
".",
Text(Var)
) + 1,
8
)
) = 2,
If(
RoundDown(
Mod(
Var * 100,
10
),
0
) = 5 && Mod(
RoundDown(
Var,
1
) * 10,
2
) = 0,
RoundDown(
Var,
1
),
RoundDown(
Mod(
Var * 100,
10
),
0
) = 5 && Mod(
RoundDown(
Var,
1
) * 10,
2
) = 1,
RoundUp(
Var,
1
),
Round(
Var,
1
)
),
Var
)
If you have more needs, please tell me and I will be happy to help you.
Best Regards,
Wearsky