Formula to divide two integers gives 0


#1

Hi all,

I have one field that holds ENROLLMENT (total students enrolled, formatted as an integer number) and another field that holds RACE (total number of students of a given race, also formatted as an integer number). I need a field that calculates % RACE, so I formatted that field as a formula, then used the field selector to select RACE / ENROLLMENT (which airtable writes as {RACE} / ENROLLMENT). However, it gives 0 all the way down the table. All other operations (+, -, *) give accurate values if I replace the division bar with those symbols.

Any idea why trying to do division returns 0s? (None of the values in the ENROLLMENT or RACE fields are 0.)


#2

Airtable doesn’t give actual percentages, the way that Excel does. You have to do the conversion yourself by multiplying by 100.

({RACE} / ENROLLMENT) * 100

And then format your formula field as a Percentage (using the “Format” menu.


#3

But it doesn’t give accurate quotients at all. Just zeros. That won’t be solved by multiplying by 100.


#4

I’m pretty sure it should, because you likely have your formula field formatted as Integer. If your division results in the actual value of 0.4 (ie, 40%), and you have it formatted to round to the nearest integer, the field will show 0.

If it just happens to be the case that all of your quotients are 44% or below, then you’ll see all 0’s with your current set up.


#5

Ohhhhh I get it. Yep, that works. Thanks!