Forum Discussion

William's avatar
William
Qrew Trainee
2 years ago
Solved

Convert yes/no multiple choice to numerical value?

Is there a way to convert text into numerical values?  What I am trying to do is have several fields where the choices can either be yes, no or NA.  I want each of these to assign a numerical value.

for example:

field one: yes = 30, n = 0, na = 30
field two: yes = 30, n = 0, na = 30
field three:  yes = 40, n = 0, na = 40

Then I want a field at the end which gives the percentage ... so if field 1 was yes, field 2 was no and field 3 was yes the score would be 70%.  Attached a mockup screenshot of what I mean.  Thanks.


------------------------------
William
------------------------------
  • No problem, you can make a formula numeric field set to display as a percentage and do the calculations all in one field.  

    var number FieldOneScore = Case([Field One],
    "yes",30,
    "n",0,
    "na",30);

    var number FieldTwoScore = Case([Field Two],
    "yes",30,
    "n",0,
    "na",30);

    var number FieldThreeScore = Case([Field Three],
    "yes",40,
    "n",0,
    "na",40)

    ($FieldOneScore + $FieldTwoScore + $FieldThreeScore) / 100

    ------------------------------
    Mark Shnier (Your Quickbase Coach)
    mark.shnier@gmail.com
    ------------------------------

3 Replies

  • No problem, you can make a formula numeric field set to display as a percentage and do the calculations all in one field.  

    var number FieldOneScore = Case([Field One],
    "yes",30,
    "n",0,
    "na",30);

    var number FieldTwoScore = Case([Field Two],
    "yes",30,
    "n",0,
    "na",30);

    var number FieldThreeScore = Case([Field Three],
    "yes",40,
    "n",0,
    "na",40)

    ($FieldOneScore + $FieldTwoScore + $FieldThreeScore) / 100

    ------------------------------
    Mark Shnier (Your Quickbase Coach)
    mark.shnier@gmail.com
    ------------------------------
    • William's avatar
      William
      Qrew Trainee
      Great, that worked.  Thanks Mark.  Any idea how I can make that field display as a percentage?  Right now it displays as a decimal (like 0.5) but I would like it to say 50%.

      ------------------------------
      William
      ------------------------------
      • MarkShnier__You's avatar
        MarkShnier__You
        Icon for Qrew Legend rankQrew Legend
        No problem, you can make the formula numeric field set to display as a percentage.  That is a setting on the Field Properties.

        ------------------------------
        Mark Shnier (Your Quickbase Coach)
        mark.shnier@gmail.com
        ------------------------------