1 Reply Latest reply: May 15, 2014 9:54 AM by Grant Perkins RSS

    If statements

    Cheryl Graham

      I'm trying to create an expression for a field that I've had to make a "character" field because it contains both character data and numeric data. Can I use an "if" statement to do the following:

      If the cell contains character data, show the character data, if the cell is actually numeric, convert the character string to a numeric?

      I've tried this, but I either get invalid delimeter or operand type:

      If(IsAlpha(field_name)=1,(field_name),val(field_name))

      Thanks!

        • If statements
          Grant Perkins

          Cheryl, welcome to the forum.

           

          In simple terms a field cannot be both character and numeric.

           

          However you could consider creating the extra calculated field as numeric and then only populating it with a value which can be numeric - so any alpha only values would perhaps need to be zero? (Null may give you other problems at some point since the only reason I can think of for requiring a numeric field is to perform some mathematical calcualtion later or for formatting with $ or thousands, etc.)

           

          So something like

           

          If(IsAlpha(field_name)=1,0,val(field_name))

           

          shoudl be close to what you would need for that (I have not tested it but it looks about right provided it is for a numeric field.)

           

          HTH

           

           

          Grant