Skip to main content

Help with DATEADD formula for start up date depending on 'Tier'

  • October 31, 2022
  • 2 replies
  • 29 views

I’m trying to set up a formula to determine the start up date of a project depending on whether it is a Tier 1 or Tier 2 event. Tier 1 will have a 4 month lead time. Tier 2 event will have a 3 month lead time.

IF ({Tier} = 1, DATEADD({Event start}, -4, ‘month’)
IF ({Tier} = 2, DATEADD({Event start}, -3, ‘month’)

This formula is ‘invalid’ - please help!

2 replies

kuovonne
Forum|alt.badge.img+29
  • Brainy
  • October 31, 2022

Welcome to the Airtable community!

You need a different nesting to you formula.


IF(
  {Tier} = 1, 
  DATEADD({Event start}, -4, 'month'),
IF(
  {Tier} = 2, 
  DATEADD({Event start}, -3, 'month')
))

There are many ways to do things in code. Here is another option.


DATEADD(
  {Event start}, 
  SWITCH( {Tier},
    1, -4,
    2, -3
  ), 
  'month'
)


  • Author
  • New Participant
  • October 31, 2022

Welcome to the Airtable community!

You need a different nesting to you formula.


IF(
  {Tier} = 1, 
  DATEADD({Event start}, -4, 'month'),
IF(
  {Tier} = 2, 
  DATEADD({Event start}, -3, 'month')
))

There are many ways to do things in code. Here is another option.


DATEADD(
  {Event start}, 
  SWITCH( {Tier},
    1, -4,
    2, -3
  ), 
  'month'
)


Thanks so much, the second formula worked!