If Statements in Survey123

141
1
07-07-2020 01:14 PM
AFackler_NAPSG
New Contributor III

I am trying to create a hidden field in S123 Connect that will automatically calculate a text value (Size field) based on an input from a previous integer question asking how many personnel are in a department. My criteria is as follows:

  • Personnel between 0-50 = Small
  • Personnel between 51-100 = Medium
  • Personnel is 101+ = Large

This has so far been my best attempt but I keep getting errors. I put this in the calculation column in the field I want the calculation to be done in. Any suggestions?

if({$total_personnel}0>=50,"Small",if({$total_personnel}51>=99,"Medium",if({$total_personnel}<=100),"Large")))

Tags (1)
0 Kudos
1 Reply
DougBrowning
MVP Notable Contributor

You need to write out both side of the check then put an and between.  I think you were nesting it correctly.  No need for a if on large since it is the only possibility left.

if({$total_personnel}>=0 and {$total_personnel}<=50,"Small",if({$total_personnel}>=51 and {$total_personnel}<=100,"Medium","Large"))

Try that.  Hope it helps.

0 Kudos