Calculation field

Hi, I have created a formula in Airtable, no problems, and it works how I want.

IF(

OR(

{Phase of Education} = “Primary”,

{Phase of Education} = “Nursery”

),

{Number of pupils} * 2,

IF(

OR(

{Phase of Education} = “Secondary”,

{Phase of Education} = “16 plus”,

{Phase of Education} = “All-though”

),

{Number of pupils} * 2.5,

BLANK()

)

)

I have tried to recreate in hubspot field:if(is_known([properties.phase_of_education]= “Primary”) or is_known([properties.phase_of_education]= “Nursery”), [properties.number_of_pupils] * 2) or if(is_known([properties.phase_of_education]= “Secondary”) or is_known( [properties.phase_of_education]= “All-through”), [properties.number_of_pupils] * 2.50)

I can’t get pass the error:

The or operator expects an argument of type Boolean but received type Number.

It does work if i remove the 2nd formula.

Any help wopuld appreciate.

Hi @GEynon,

Can you please share a screenshot of the entire calculation property configuration?

Generally, it is as the error message says…

if(is_known([properties.phase_of_education]= “Primary”) or is_known([properties.phase_of_education]= “Nursery”), [properties.number_of_pupils] * 2)
or
if(is_known([properties.phase_of_education]= “Secondary”) or is_known( [properties.phase_of_education]= “All-through”), [properties.number_of_pupils] * 2.50)

… the OR operator expects an argument of type boolean but it receives a number. Resulting in a formula that tries to return the first number or the second number, which it can’t in a sensible way.

It looks like you’re trying to achieve this:

  • If the Phase of Education is Primary or Nursery, then multiply the Number of pupils by 2.
  • Otherwise, if the Phase of Education is Secondary, 16 plus, or All-through, then multiply the Number of pupils by 2.5.
  • If the Phase of Education is none of those, leave the result blank.

In that case, you would have to do the following in the formula editor and nest the if statements:

if([properties.phase_of_education]= “Primary” OR [properties.phase_of_education]= “Nursery”,[properties.number_of_pupils] * 2,if([properties.phase_of_education]= “Secondary” OR [properties.phase_of_education]=“All-through”,[properties.number_of_pupils] * 2.5))

Best regards

Perfect thankyou

Here you go :grinning_face:

@GEynon I’ve updated my previous reply. I’m not the best at writing formulas out without seeing messages about the errors I’m creating, but the general idea should be clear :slightly_smiling_face: