• 0

# Calculated value not returning decimals

## Question

I am attempting to collect time in seconds and using virtual field and calculated data, place in a table in decimal format.

I have in the calculated field the following formula

([@Virtual1]/60)

The user input time in seconds  (ie. 145)  and the field in the data should display 2.416666. But it is not. It is displaying 2

I have attempted using Functions (Str, Round, Abs) and using formatting in the Datapage Elements.

The  field type in the table is Number.

The field is hidden on the datapage.

Where is my mistake?

## Recommended Posts

• 0

I think the virtual field is being rendered as an integer which is causing the output to be rounded off to the nearest whole value.

Try this formula to convert the virtual field to a float/number data type first before the calculation:

CONVERT(FLOAT, [@cbParamVirtual1]) / 60

https://howto.caspio.com/function-reference/#:~:text=Miscellaneous Functions and Expressions

##### Share on other sites

• 0
13 minutes ago, Tubby said:

I think the virtual field is being rendered as an integer which is causing the output to be rounded off to the nearest whole value.

Try this formula to convert the virtual field to a float/number data type first before the calculation:

CONVERT(FLOAT, [@cbParamVirtual1]) / 60

https://howto.caspio.com/function-reference/#:~:text=Miscellaneous Functions and Expressions

BINGO! Thank you so very much. Domo Arigato. Danke sehr. Merci beaucoup. Gracias.

##### Share on other sites

• 0

BINGO! Thank you so very much. Domo Arigato. Danke sehr. Merci beaucoup. Gracias.

Since 60 is constant, you can also make it 60.0 , add the .0 so the system will know it's supposed to be float

##### Share on other sites

• 0

Hello - if you want to use ROUNDDOWN and ROUNDUP like from Excel, you can use these formulas:

Excel:

Round to last nearest 5 = ROUNDDOWN(A2/5,0)*5
Round to last nearest 10 = ROUNDDOWN(A2/10,0)*10
Round to last nearest 50 = ROUNDDOWN(A2/50,0)*50
Round to last nearest 100 = ROUNDDOWN(A2/100,0)*100

Caspio:

`FLOOR([@field:Number]/50)*50`

Excel:

Round to next nearest 5 = ROUNDUP(A2/5,0)*5
Round to next nearest 10 = ROUNDUP(A2/10,0)*10
Round to next nearest 50 = ROUNDUP(A2/50,0)*50
Round to next nearest 100 = ROUNDUP(A2/100,0)*100

Caspio:

`CEILING([@field:Number]/5)*5`

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.