Skip to main content
Question

calculating percentages based on checkboxes

  • Oct 10, 2018 10:57 PM UTC
  • 0 replies
  • 219 views

I am looking for a way to calculate a percentage based on a checkbox and if a value exists for a specific field. So basically:

If(([Checkbox]=true) & [Field 1B]=" ", [Field 1A]/[Field 1B], 
([Checkbox]=true) & [Field 2B]=" ", [Field 2A]/[Field 2B],
([Checkbox]=true) & [Field 3B]=" ", [Field 3A]/[Field 3B]),...

My goal is if a record's Checkbox is checked and it contains a value in Field 1A, then calculate Field 1A & Field 1B percentage. If Field one 1A does not contain a value, then check Field 2A for value, and Field 2B/Field 2A (and so on). 

As of now, the result I'm getting is blank. I've tested with various Fields and not getting a different result. Would appreciate any help!


This topic has been closed for replies.

Forum|alt.badge.img+17
  • Community Moderator
  • Oct 10, 2018 11:00 PM UTC
Hi Courtney,

Looking at this formula the second condition in your if is [Field 1B]=" " which would be if this checkbox is true and Field 1B is blank then divide Field 1A by Field 1B which would be blank and wouldn't return a value then. Should it instead be when Field 1B is not equal to blank or is not null?

Something like 

If(([Checkbox]=true) & [Field 1B]<>0, [Field 1A]/[Field 1B], 
([Checkbox]=true) & [Field 2B]<>0, [Field 2A]/[Field 2B], 
([Checkbox]=true) & [Field 3B]<>0, [Field 3A]/[Field 3B]) . . . .

  • Author
  • Registered
  • Oct 10, 2018 11:03 PM UTC
Yes! For all Field #B = " " I want them to be "is not blank", I thought that's what " " meant? 

Forum|alt.badge.img+17
  • Community Moderator
  • Oct 10, 2018 11:06 PM UTC
In that instance if they are numeric fields I would suggest using <>0, which is the formula notation for is not equal to 0. Then it will check the numeric field is not zero and run the math. This will try to run the math if that number in those field is ever negative though as well. Where something like [Field B]>0 will only do the math if that field is a positive number, depending on how the math in that field works out.

  • Author
  • Registered
  • Oct 10, 2018 11:20 PM UTC
So it is a numeric field, but the <>0 is not working? Here's how I entered:

If(([Checkbox]=true) & [Field 1B]<>0, [Field 1A]/[Field 1B]

I'm getting this error: 


Is there a way to do not Null? I tried just not IsNull and that didn't work either...

Forum|alt.badge.img+17
  • Community Moderator
  • Oct 10, 2018 11:25 PM UTC
What is the field type for Field 1B?