Solved

Hello, I have a list of numbers that I want to round to the closest even number after the point. It should round it to one decimal. What formula to use ?

  • 14 March 2022
  • 3 replies
  • 2 views

Badge +8

Here are some examples:

original data

497.2594497509648

497.3865

495.31

495.29

expected result:

497.2

497.4

495.4

495.2

And I have another case where I want to round my list of numbers to the closest of four options: integer, ending with .25 or ending with .5 or ending with .75.

my examples:

original data

497.2594497509648

497.8865

495.77

495.45

expected result:

497.25

498

495.75

495.5

thank you.

icon

Best answer by DanAtSafe 14 March 2022, 23:06

View original

3 replies

Userlevel 5
Badge +29

In your examples, you inconsistently round - eg 497.3895 and 495.31 both round up to xxx.4, whereas 495.29 rounds down to 495.2.

 

Scenario 1, use the AttributeRounder

scenario 2, use the following statement - @Evaluate(@round(@Value(_list)*4,0)/4)

 

 

Userlevel 1
Badge +11

Scenario 1, multiply by 5, round, then divide by 5 

@round(@Value(attrib1) * 5) / 5

 

Userlevel 5
Badge +29

In your examples, you inconsistently round - eg 497.3895 and 495.31 both round up to xxx.4, whereas 495.29 rounds down to 495.2.

 

Scenario 1, use the AttributeRounder

scenario 2, use the following statement - @Evaluate(@round(@Value(_list)*4,0)/4)

 

 

@katt​, misread the first part re even numbers. @danatsafe​  gives the correct answer :)

Reply