Nan Error To Calculate Percentage

Hi All,

I am very new to airtable and trying to decide if this tool is right for our team. I think that it is, I am just having an issue trying to calculate the percentage.

I have a count of subtasks as well as a count of the completed subtasks (linked record to another table,‘subtasks’). I wanted to use these two fields to calculate the percentage of completion. I added a new field and called it percentage complete and used the below formula: {Number of Completed Subtasks}/Number of subtasks and formatted as percentage.

Since some items do not have any subtasks at all (0) I am getting the NaN error for percentage. How can I rectify this so that the NaN error, essentially 0/0 returns an actual percentage to help me with the bigger picture?

I have added a screenshot for reference:

any help is appreciated, thanks!

Hi there! You’ll want to use an IF() statement to first check if there is a value in {Number of Subtasks} before using it as a divisor. Try this…

IF({Number of SubTasks}, {Number of Completed Subtasks} / {Number of SubTasks}, 0)

This should return the percent complete if there are subtasks, otherwise it should return 0%.

Hope this helps!

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.