I need to count how many hotel rooms nights I’m using on a given night, which will then be subtracted from the number of hotel room I have for that night in my room block.
Is this possible in Airtable?
Page 1 / 1
You could use IS_AFTER() and IS_BEFORE() functions along with AND, which would give you a 0/1 result:
AND(IS_AFTER({Date to Check},{Start Date}), IS_BEFORE({Date to Check},{End Date}))
You could use IS_AFTER() and IS_BEFORE() functions along with AND, which would give you a 0/1 result:
AND(IS_AFTER({Date to Check},{Start Date}), IS_BEFORE({Date to Check},{End Date}))
Thanks the the suggestion. This is probably a novice question, but for the “Date to Check” can I use a hard-coded date (e.g., “02-28-2019”), or does it have to be a reference?
Hard-coded works as well, though it’ll bloat the formula more than if you’d used a reference. You can’t just give it a string “02-28-2019” and have it work. It’ll need to be converted into a datetime item using the DATETIME_PARSE() function. And if locking to your local timezone is important, you’ll also need to wrap that around your date formula. So for every place that you see {Date to Check} in my sample above, you would instead use (obviously using your own timezone indicator):
Like I said, it bloats it quite a bit, but sometimes that’s what’s needed.
Hard-coded works as well, though it’ll bloat the formula more than if you’d used a reference. You can’t just give it a string “02-28-2019” and have it work. It’ll need to be converted into a datetime item using the DATETIME_PARSE() function. And if locking to your local timezone is important, you’ll also need to wrap that around your date formula. So for every place that you see {Date to Check} in my sample above, you would instead use (obviously using your own timezone indicator):