Dec 18, 2022 05:27 AM
I am new here, so please forgive me if I ask a question that might have been asked before.
I keep track of my software subscriptions with Airtable, some are monthly based and some are yearly. Therefore, I created a single selection field with two options (monthly, yearly) and a date field that shows when the subscriptions are due. Now I would like to automatically update the due date after it has passed under the condition of monthly or yearly.
I had something in mind like: IF ({subscription} = "yearly", NOW(), DATEADD( *1, 'year')({subscription} = "monthly", NOW(), DATEADD( *1, 'month')
I guess it's terribly wrong, since it never worked 😭
Solved! Go to Solution.
Dec 18, 2022 06:25 AM
hi,
It should look like
IF(subscription="yearly",DATEADD(NOW(),1,"year"),DATEADD(NOW(),1,"month"))
Dec 18, 2022 06:35 AM
I assumed there could be only two options.
you can also use the SWITCH formula like this
SWITCH(
subscription,
'yearly',DATEADD(NOW(),1,'year'),
'monthly',DATEADD(NOW(),1,'month')
)
Dec 18, 2022 08:43 AM
@Ilan_Ben_Yaakov , @HaraldPalma I think there should be another correction. NOW() function will update the value of the field each day and you are going to have never-ending subscription, which is maybe good, but out of reality )). So I suggest to have a date field where you would store the starting date of a subscription, and this field you address in you formula.
SWITCH(
subscription,
'yearly',DATEADD({start of subscrition},1,'year'),
'monthly',DATEADD({start of subscrition},1,'month')
)
Dec 18, 2022 06:25 AM
hi,
It should look like
IF(subscription="yearly",DATEADD(NOW(),1,"year"),DATEADD(NOW(),1,"month"))
Dec 18, 2022 06:35 AM
I assumed there could be only two options.
you can also use the SWITCH formula like this
SWITCH(
subscription,
'yearly',DATEADD(NOW(),1,'year'),
'monthly',DATEADD(NOW(),1,'month')
)
Dec 18, 2022 08:43 AM
@Ilan_Ben_Yaakov , @HaraldPalma I think there should be another correction. NOW() function will update the value of the field each day and you are going to have never-ending subscription, which is maybe good, but out of reality )). So I suggest to have a date field where you would store the starting date of a subscription, and this field you address in you formula.
SWITCH(
subscription,
'yearly',DATEADD({start of subscrition},1,'year'),
'monthly',DATEADD({start of subscrition},1,'month')
)
Dec 18, 2022 09:08 AM
Thank you very much! Such a nice welcoming in this forum, and two excellent solutions 🙂 I didn't think of the SWITCH - great idea. I guess it's either or if both ways work.
Dec 18, 2022 09:09 AM
- that was right 🙂 - this was the solution I used - thank you!