Skip to main content

Fill in cell as '1' if the formula gives 'NaN'.


Forum|alt.badge.img+4

The cell gives an error (NaN) when the linked table does not contain any linked records. I want to create a formula that will fill-in the cell as '1' if the 'average (values)' is not possible. 

Thank you.

3 replies

alxwlfe_airbnb
Forum|alt.badge.img+10
  • Participating Frequently
  • 14 replies
  • December 1, 2023

Okay so one way to do this is to add some sneaky formula logic to the rollup formula:

IF( values, AVERAGE(values))

 So IF the rollup has values (or if there are linked records), do the AVERAGE, but IF NOT, it outputs nothing.

 

One thing to be aware of are 'ghost' or null values that may throw this off. So alternatively you could toggle on "Only include records from the..." option and filter to just records with a value in the Exchange rate field


Forum|alt.badge.img+4
  • Author
  • Participating Frequently
  • 6 replies
  • December 7, 2023
alxwlfe_airbnb wrote:

Okay so one way to do this is to add some sneaky formula logic to the rollup formula:

IF( values, AVERAGE(values))

 So IF the rollup has values (or if there are linked records), do the AVERAGE, but IF NOT, it outputs nothing.

 

One thing to be aware of are 'ghost' or null values that may throw this off. So alternatively you could toggle on "Only include records from the..." option and filter to just records with a value in the Exchange rate field


Thank you very much. This is already very useful.

Now I want the empty cells to be filled with the number 1, because it is used for a calcalution of another cell. Could that be added to the formula? 

Thank you!


alxwlfe_airbnb
Forum|alt.badge.img+10
  • Participating Frequently
  • 14 replies
  • December 7, 2023
Airtable_admin11 wrote:

Thank you very much. This is already very useful.

Now I want the empty cells to be filled with the number 1, because it is used for a calcalution of another cell. Could that be added to the formula? 

Thank you!


Oh, yes, you could add that to the end of the IF() function:

IF( values, AVERAGE(values),1)

 


Reply