Mar 15, 2018 05:28 PM
What I want to do is insert a formula in an airtable field that multiply’s values I input in Hourly rate, hours and rate fields. This is the formula I have tried but I get an error
{Hourly Rate}HoursRate
I’ve attached the spead sheet image of what I want to do on airtable
Mar 16, 2018 03:31 AM
I don’t understand your image, but the formula misses some kind of operation:
{Hours} * 40
{Hours} * {Rate}
. Maybe you have to use INT()
in the formula to get the number from the select field.Mar 16, 2018 11:29 AM
There’s your problem, right there. :winking_face:
Without breaking into my ‘Airtable Is Not a Spreadsheet’ sermon, let me note that, um, Airtable is not a spreadsheet; while that metaphor may be an excellent way to introduce someone to Airtable’s look and feel, it often leads to confusion for new users, as it suggests false equivalences. Let me try to explain using an analogy that no doubt is equally as far off the mark…
The obvious — and erroneous — way to visualize the comparison between Airtable and a spreadsheet is:
Airtable | spreadsheet |
---|---|
row | row |
table | spreadsheet |
base | workbook |
Based on data visibility, though, the reality is more like this:
Airtable | spreadsheet |
---|---|
row | spreadsheet |
table | workbook |
base | workbooks(?) |
As I said, the analogy isn’t perfect. The thing to remember, though, is that every item in a spreadsheet has visibility of any other item in its two-dimensional plane. In Airtable, though, an item can see only those items along the same row. There are ways around this, but they all involve somehow getting data to surface on the necessary row.
If one were to implement your sample screenshot literally within Airtable, the result would be five records containing such fields as {Date}
, {Hours}
, {Rate}
, and so forth, along with a sixth record containing only the {Hourly Rate}
. Since none of the records has any visibility into any other record, as you discovered, you cannot use {Hourly Rate}
in a calculation.
The easiest solution, then, is to add {Hourly Rate}
as a seventh column of your table; then, the formula
{Hours}*{Rate}*{Hourly Rate}
will work.
To keep employees (or you!) from having to enter {Hourly Rate}
for each record, there are options:
{Hourly Rate}
as a numeric field with a default value; collaborators with edit ability can change the default value to reflect their own hourly rates before submitting an overtime request,[Employees]
, which includes (at least) the employee’s name or number and his or her hourly rate. By using a field linked to the former, you could then access the latter for calculations. (Of course, then you’d face the problem of having to enter the employee’s name or number into each record… :winking_face: )(Hmmm… I see that all of my replies today should come with an embedded TL;DR
tag…)
Mar 17, 2018 07:00 AM
Thanks. Sort of working now…
So it seems in order to perform the calculation, I can’t have a column set as currency (for the hourly rate) and another column set as multiple select (for the overtime rate)
Now that all columns are set as numeric, the formula is working !!!
Weirdly, setting the default value for hourly rate is not pre-filling the cell ?
Mar 17, 2018 07:03 AM
Actually the default value IS working when I add a new record :slightly_smiling_face:
Mar 17, 2018 03:44 PM
Single-select fields evaluate as strings, so to use the field in a numeric calculation, simply wrap it with the VALUE()
function:
{Hours}*VALUE({Overtime Rate})*{Hourly Rate}
Mar 17, 2018 08:15 PM
Brilliant
Working perfectly
Thanks again