Help

The Community will be temporarily unavailable starting on Friday February 28. We’ll be back as soon as we can! To learn more, check out our Announcements blog post.

Nan Error To Calculate Percentage

Topic Labels: Formulas
Solved
Jump to Solution
2311 1
cancel
Showing results for 
Search instead for 
Did you mean: 
Sarah_Morris
4 - Data Explorer
4 - Data Explorer

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:
image

any help is appreciated, thanks!

1 Solution

Accepted Solutions
AlliAlosa
10 - Mercury
10 - Mercury

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!

See Solution in Thread

1 Reply 1
AlliAlosa
10 - Mercury
10 - Mercury

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!