# How to have two formulas in one field and use any depending on response of a previous selection question?

571
2
01-04-2023 01:00 PM
New Contributor II

I am trying to develop my syntax to have two formulas in one field and based on a previous question, either or would be used to carry out the calculation.

For example:

1. Type of Meter

• With CT
• Without CT

2. kw calculation

I have these two formulas that I would want to use depending on response on #1.

round((3.6*21.6)div\${seconds1},1) applicable only if Without CT was selected

round((3.6*1.8*\${factor})div\${seconds1},1) applicable only if With CT was selected

How can I setup these two formulas in one field and based on type of meter selected previously that it would proceed to calculate.

Tags (4)
1 Solution

Accepted Solutions
MVP Esteemed Contributor

if(\${ctfield} = 'Without CT' and \${ctfield} != '', round((3.6*21.6)div\${seconds1},1), round((3.6*1.8*\${factor})div\${seconds1},1) )

I added the check for blank.  But this assumes there is only 2 options.  If there are more you could do this so that it does nothing if it is any other choice.

if(\${ctfield} = 'With CT', round((3.6*21.6)div\${seconds1},1), if(\${ctfield} = 'Without CT', round((3.6*1.8*\${factor})div\${seconds1},1) , ''))

hope that helps

2 Replies
MVP Esteemed Contributor

if(\${ctfield} = 'Without CT' and \${ctfield} != '', round((3.6*21.6)div\${seconds1},1), round((3.6*1.8*\${factor})div\${seconds1},1) )

I added the check for blank.  But this assumes there is only 2 options.  If there are more you could do this so that it does nothing if it is any other choice.

if(\${ctfield} = 'With CT', round((3.6*21.6)div\${seconds1},1), if(\${ctfield} = 'Without CT', round((3.6*1.8*\${factor})div\${seconds1},1) , ''))

hope that helps

New Contributor II

Yes it did @DougBrowning.

Thank you so much!