Discussions

 View Only
  • 1.  Convert yes/no multiple choice to numerical value?

     
    Posted 08-03-2022 21:34
    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.
    This shows basically what I am trying to achieve.


    ------------------------------
    William
    ------------------------------


  • 2.  RE: Convert yes/no multiple choice to numerical value?
    Best Answer

    Posted 08-03-2022 22:24
    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.  RE: Convert yes/no multiple choice to numerical value?

     
    Posted 08-04-2022 15:05
    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
    ------------------------------



  • 4.  RE: Convert yes/no multiple choice to numerical value?

    Posted 08-04-2022 15:09
    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
    ------------------------------