Jump to content
• 0

# Conditional statement in formula

## Question

I have a table with a field named Total_Time with a function datatype, that calculates total time using the flowing formula..

Round(((([@field:End_Hour] - [@field:Start_Hour]) * 60 + ([@field:End_Min]-[@field:Start_Min]))

- (([@field:Break_Fin_Hour] - [@field:Break_Start_Hour]) * 60 + ([@field:Break_Fin_Min]-[@field:Break_Start_Min]))) /60 ,2)

This works as expected… Now I would like to add a conditional statement that checks the value of the field "Assigned_Tech" and if the value is “Summary” then leave the Total_Time field blank, else run the formula.

Im thinking..

CASE

IF ([@field: Assigned_Tech])!==”Summary”

THEN

Round(((([@field:End_Hour] - [@field:Start_Hour]) * 60 + ([@field:End_Min]-[@field:Start_Min]))

- (([@field:Break_Fin_Hour] - [@field:Break_Start_Hour]) * 60 + ([@field:Break_Fin_Min]-[@field:Break_Start_Min]))) /60 ,2)

END

Can someone please help me with the correct case statement to use. I spent 2 days writing the total_time formula and now am in a bit over my head using conditional statements in the formula.
Thanks in advance for any an all help

## Recommended Posts

• 0

Hi JEllington,

You should use "WHEN" i.o. "IF" in a Case statement.

Hope this helps.

##### 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.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
• #### Browse

×
• Create New...