You are viewing limited content. For full access, please sign in.

Question

Question

Adding Formula in Forms for Singe Line Values

asked on September 11, 2017

I am trying to insert a formula on my Total Points Assessed field but can not seem to get the formula to work.  Trying to add up the numeric value from single line fields A - Points + E - Points + I - Points = Total Points Assessed.   Any thoughts would be appreciated.  Thanks!

 

0 0

Replies

replied on September 11, 2017

Just to clarify, are these all set as "Number" type fields? What is your current formula? And what exactly is going wrong at this point?

0 0
replied on September 11, 2017

I'm using "Single Line" Fields with a numeric value.  Current formula is =SUM(A___Points , E___Points, I___Points)   The formula returns the number 0.

0 0
replied on September 11, 2017

Do I need to change the "Single Line" Fields to "Number" Fields to make the formula work?

0 0
replied on September 11, 2017 Show version history

The formula will view a Single Line as a string value even if it is numeric. In programming, it is like the difference between x = 2 and x = "2". The first one says x is equal to two, the second says x equals the character 2.

I think there are ways to force a conversion to numeric values using functions, but it makes way more sense to use numeric fields because it will also control user input so you don't have to worry about people inputting letters or anything like that.

0 0
replied on September 11, 2017

I changed the fields to "number" and the formula worked.  Thank you for your help, Jason!

1 0
replied on September 11, 2017

No problem! If you get a chance, mark it as "answered" just in case anyone else runs into the same problem and is looking for a solution.

1 0
replied on September 12, 2017

Jason,

I have another question for you.  Not sure if this can be done with a formula.  When a user fills out TABLE 1 - Injuries they will select from a drop down box A, B, C, D or N/A.  

After the user makes a selection I have a field rule that will assign points in a field.  For example, A - Points  0, B - Points 2, C - Points 4, D - Points 8.  

The form has two other sections just like the above.  I'm trying to have the formula add up only the points selected.  My current formula adds every field up.  A - Points through J - Points.  

Any thoughts?

Thanks!  Pete

0 0
replied on September 12, 2017

If you're using tables or collections, you'll need to incorporate INDEX and ROW() into your functions.

For example,

=INDEX(table.column,ROW())

ROW() will return the row number for that specific field, and that will tell INDEX which of the values to use.

I'm not sure exactly how you have everything set up as far as Tables and Collections and such, but if two fields share the same variable name, INDEX is what you need to tell it to only use a specific instance of that field value.

0 0
replied on September 13, 2017

I'm not using tables or collections if that helps.  

0 0
replied on September 13, 2017

Okay, if I'm understanding the question correctly, it sounds like you might need to wrap each value within the SUM function in an IF() function.

SUM(IF(value1<>"",value1,0),IF(value2<>"",value2,0),IF(value3<>"",value3,0))

This would check the value of each field. If it is empty, is assigns 0 points, if there is a selection, it would add the point value from the field.

You might need a nested IF within each one to account for the "N/A" selection, but this should get you started. For example IF(value<>"",IF(value<>"N/A",value,0),0)

What is your current formula, and what are the exact conditions you're looking to enforce?

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.