# IF, ROUNDUP Function

Topic Labels: Formulas
Solved
1112 3
cancel
Showing results for
Did you mean:
4 - Data Explorer

Hello, I am trying to write an equation for total pallets used. If the total cartons is over 4it gets palletized. My equation is `IF(Cartons > 4, ROUNDUP(Cartons/{Cartons per Pallet}), 0)`. but Airtable wont accept it. Any advice?

1 Solution

Accepted Solutions
18 - Pluto

I saw that shifted parenthesis, but wasn’t sure about mentioning it. Some functions have optional arguments, and I couldn’t recall from prior experience if that last argument fell into that category, so that might have indicated the fallback value for the `IF()` function. I should’ve just looked at the documentation for `ROUNDUP()`, where it says, “You must give a value for the precision or the function will not work.” :slightly_smiling_face:

3 Replies 3
18 - Pluto

Welcome to the community, @Joel_Kay! :grinning_face_with_big_eyes: What type of field is `{Cartons}`? If it’s a lookup field, you’re most often dealing with an array of values, not a single value. In some cases Airtable will auto-convert a one-item array into a single data value, but not always (see this base that I made for more info on what each field type returns, including when collected by a lookup field).

If it’s not a lookup, please share more details and we can go from there.

4 - Data Explorer

Thanks Justin. Cartons is another formula running off other data in the field. I believe I got it situated by moving the parenthesis at the end of “{Cartons per Pallet}” to the end of the equation to read: IF(Cartons > 4, ROUNDUP(Cartons/{Cartons per Pallet}, 0))

18 - Pluto

I saw that shifted parenthesis, but wasn’t sure about mentioning it. Some functions have optional arguments, and I couldn’t recall from prior experience if that last argument fell into that category, so that might have indicated the fallback value for the `IF()` function. I should’ve just looked at the documentation for `ROUNDUP()`, where it says, “You must give a value for the precision or the function will not work.” :slightly_smiling_face: