If statement question using numeric field

  • 0
  • 1
  • Question
  • Updated 2 years ago
  • Answered
I have created the following formula

If (not IsNull([Vendor Compensation]),[Vendor Compensation],IsNull([Vendor Compensation]),[Event - Net to Artist])

It will return a value for the first part of the if statement (not IsNull([Vendor Compensation]),[Vendor Compensation]) but won't return a value for the second part of the statement.  How can I get both to return a value
Photo of Scott

Scott

  • 240 Points 100 badge 2x thumb

Posted 2 years ago

  • 0
  • 1
Photo of QuickBasePros_IDS

QuickBasePros_IDS, Champion

  • 3,812 Points 3k badge 2x thumb
Try this:

If(not IsNull([Vendor Compensation]),[Vendor Compensation],[Event - Net to Artist])


If this doesn't work, make sure that the checkbox that reads empty values as 0 in formulas is unchecked in the [Vendor Compensation] field and try again.

An IF is an IF, ELSE statement; so you don't need to put the negative.
Photo of Scott

Scott

  • 240 Points 100 badge 2x thumb
Thanks!  The change to the "empty value as zero" in the Vendor Compensation filed was the key to making this formula work.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,806 Points 50k badge 2x thumb
Scott, note now that if you were to a create up a summary field of the total of vendor compensation and some values were null (blank) your total will be null too.  I think the total of a column on a table would be null too.
Photo of Tony

Tony

  • 194 Points 100 badge 2x thumb
I have a numeric field and here's the statement I'm trying and it keeps giving me and error:

If([Rate your pain 5-10]="5","Moderate","")
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,806 Points 50k badge 2x thumb
Can you post this as a new question as it does not seem to have anything to do with this thread.
Photo of QuickBasePros_IDS

QuickBasePros_IDS, Champion

  • 3,812 Points 3k badge 2x thumb
If [Rate your pain 5-10] is a numeric or rating field, you probably have to write it as number rather than text.  ie. =5,"Moderate","")
Photo of Tony

Tony

  • 194 Points 100 badge 2x thumb
I read the headline and the overall concept is similar to my question.  But I'll start a new thread with the same question.  Thanks
Photo of Tony

Tony

  • 194 Points 100 badge 2x thumb
QuickBasePros_IDS - Thanks.  I thought I tried that already.  I guess I didn't.