Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
7

Rounding Calculations Don't Work

Community Beginner ,
Jun 26, 2023 Jun 26, 2023

Hello

I have an expense report that is driving me crazy.

Travel Expense Area specifically.

 

e.g.

 Step 1 - MilesRow 1 is number of miles manually entered'

Step 2-   MCost1 is the product of MilesRow1 x 0.655 (current rate)

I have twelve lines.

Step 3- MilesTOTALMILEAGE is sum of all MilesRow lines 1-12
Step 4- Mileage Cost Total is sum of all MCOST rows 1-12.  (This is the one not working)

The numbers add up across, but do not calculate properly in the final Mileage Cost Total

Attached is the form. As you can see. with the numbers I plugged in. It should be $24.25 not $24.24. This wreaks havoc wth accounting.  All are formatted to 2 decimals. All are calculated using simplified notations or Value is the sum of...

 

HELP!

 

 

 

TOPICS
How to , PDF forms
894
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 26, 2023 Jun 26, 2023

Correction I put in 1 mile in each area and it should add up to .665 x 3= 1.98 but it shows 1.97

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 27, 2023 Jun 27, 2023

You need to fix the fields calculation order. The totals should appear at the bottom of the list.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 27, 2023 Jun 27, 2023

Thanks but i did that and didnt change anything

 

carolpaspasia_0-1687874861047.png

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 27, 2023 Jun 27, 2023

The issue with the rounding is that the numbers you're seeing are not the actual field values (because of the Format options you selected). If you click the Cost fields you'll see that they change from 0.65 to 0.655. The latter is the actual value. If you want to round them you need to use a script. So, for example, for the first field use this code:

 

event.value = (Number(this.getField("MilesRow1").valueAsString) * 0.655).toFixed(2);

 

Do that to all the fields and their display values will match their actual ones. You should also remove the Format setting, so the real value is no longer hidden.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 27, 2023 Jun 27, 2023
LATEST

Thank you! The script work.  I appreciate your input.  My accounting dept thanks you!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines