Skip to main content
Solved

Check a date against a static date

  • April 4, 2022
  • 6 replies
  • 28 views

Forum|alt.badge.img+3

Wanting to check Date of birth against a static date, if true emoji if not blank.

If(DOB<=12/31/2017, :star: ," ")

Best answer by kuovonne

IF(
  DATESTR({DOB}) <= "2017-12-31",
  "star"
)

6 replies

Forum|alt.badge.img+11
  • Participating Frequently
  • April 4, 2022

hi @RJ_Southam,
Your formula is correct as long as the field with the date of birth is called DOB.
I would possibly modify it to this: If(DOB<=12/31/2017, :star: ,"") if you want to actually have a blank field when the condition does not hold instead of a field with a space.

Hope this helps!

Website: alessiomonino.com
Calendly: Calendly - Alessio Monino
Email: alessio.monino@gmail.com


Forum|alt.badge.img+3
  • Author
  • Participating Frequently
  • April 5, 2022

hi @RJ_Southam,
Your formula is correct as long as the field with the date of birth is called DOB.
I would possibly modify it to this: If(DOB<=12/31/2017, :star: ,"") if you want to actually have a blank field when the condition does not hold instead of a field with a space.

Hope this helps!

Website: alessiomonino.com
Calendly: Calendly - Alessio Monino
Email: alessio.monino@gmail.com


Thanks Alessio, any other idea it still says invalid formula I tired =< and <= I also tried brackets around the date…


kuovonne
Forum|alt.badge.img+29
  • Brainy
  • Answer
  • April 5, 2022
IF(
  DATESTR({DOB}) <= "2017-12-31",
  "star"
)

kuovonne
Forum|alt.badge.img+29
  • Brainy
  • April 5, 2022

hi @RJ_Southam,
Your formula is correct as long as the field with the date of birth is called DOB.
I would possibly modify it to this: If(DOB<=12/31/2017, :star: ,"") if you want to actually have a blank field when the condition does not hold instead of a field with a space.

Hope this helps!

Website: alessiomonino.com
Calendly: Calendly - Alessio Monino
Email: alessio.monino@gmail.com


Actually the original formula had several issues.

  • Emoji are characters and need to be enclosed in straight quotes.

  • Hardcoded date strings need to be enclosed in straight quotes. As written 12/31/2017 is a mathematical expression that evaluates to about 0.000191917091816.

  • It is also better to compare text strings with text strings rather than hoping that Airtable will correctly do data type conversion.

  • it is better to completely omit the third parameter than to include a text string of one space or an empty text string.


Forum|alt.badge.img+3
  • Author
  • Participating Frequently
  • April 5, 2022
IF(
  DATESTR({DOB}) <= "2017-12-31",
  "star"
)

Thank you that worked!


Forum|alt.badge.img+3
  • Author
  • Participating Frequently
  • April 5, 2022
IF(
  DATESTR({DOB}) <= "2017-12-31",
  "star"
)

Would you help me with a second part I want to flag children that are turning 3 this year as of today.
IF(
DATESTR({DOB}) <= “2017-12-31”,
“ :mortar_board: ”,IF(
DATESTR({DOB}) between today and “2019-12-31”, :balloon:
)