Save the date! Join us on October 16 for our Product Ops launch event. Register here.
Oct 01, 2020 09:01 AM
Here’s the formula I’m using:
IF(
{Number Field 1}!=’’,
({Number Field 1} / {Weight (number field)} + {Number Field 2}),
IF(
{Number Field 2}!=’’,
({Number Field 1} / {Weight} + {Number Field 2}),
‘’)
)
My goal with the formula:
I’m trying to reach an inventory count as a result of this field.
A) If the inventory count is low, we can manually enter the exact count of the part into “Number Field 2”
B) If the inventory count is higher, we get an approximate count based on weight. So we enter the weight into “Number Field 1” of the total part. It calculates total weight vs the part weight to give us a part count.
C) If for some reason during the process we weigh the inventory, but find more of that part, we sometimes add the exact count on after. So if there’s numbers in each of the field, we need the formula to account for both.
The result of the formula “works”, as in the numbers are right. But it isn’t a number output. So for us to use the result of the field, or format the output, it isn’t working for us.
Solved! Go to Solution.
Oct 01, 2020 09:18 AM
You’ll need to remove the final quotation marks (''
) from your formula.
Unlike other programming languages where you can explicitly set the field type that a formula field should result in, Airtable AUTOMATICALLY CHOOSES the field type based on ALL the possible responses that your formula field might yield.
In other words, if ALL of your possible responses result in a number, then Airtable’s formula will result in a number field. Otherwise, it results in text.
Hope this helps! If this answers your question, could you please mark this comment as the solution to your question? This will help other people who have a similar question. :slightly_smiling_face:
Oct 01, 2020 09:18 AM
You’ll need to remove the final quotation marks (''
) from your formula.
Unlike other programming languages where you can explicitly set the field type that a formula field should result in, Airtable AUTOMATICALLY CHOOSES the field type based on ALL the possible responses that your formula field might yield.
In other words, if ALL of your possible responses result in a number, then Airtable’s formula will result in a number field. Otherwise, it results in text.
Hope this helps! If this answers your question, could you please mark this comment as the solution to your question? This will help other people who have a similar question. :slightly_smiling_face:
Oct 01, 2020 09:21 AM
When I was building this formula, I tried doing that and got an error. So I thought it was critical to have that there. But I realized, the error was coming from the remaining “comma” after removing those quotes.
Your solution worked! Thank you!
Oct 01, 2020 09:32 AM
Ah, right! Remove the comma AND the quotes.