Skip to main content
Solved

IF Formula using dates

  • August 4, 2021
  • 5 replies
  • 36 views

Hello all,

I would like to use an If formula:

Everything before a certain date should be “True”, everything after “False”.

When I write it like this, it doesn’t work:

IF(InvoiceDate<3/8/2021,1,2) (InvoiceDate is a Field in Type “Date” with Format “European”).

Do you have any idea and could you help me please? Thank you very much!

Best answer by Databaser

Hi @Sebastian_Apel

Airtable doesn’t recognise the “3/8/2021” as a date witch which it can work. You have to convert it into a date type using DATETIME_PARSE().

This should work:

IF(InvoiceDate<DATETIME_PARSE("03-08-2021", "DD-MM-YYYY"), 1, 2)

5 replies

Databaser
Forum|alt.badge.img+25
  • Brainy
  • Answer
  • August 4, 2021

Hi @Sebastian_Apel

Airtable doesn’t recognise the “3/8/2021” as a date witch which it can work. You have to convert it into a date type using DATETIME_PARSE().

This should work:

IF(InvoiceDate<DATETIME_PARSE("03-08-2021", "DD-MM-YYYY"), 1, 2)


  • Author
  • New Participant
  • August 4, 2021

Hi @Sebastian_Apel

Airtable doesn’t recognise the “3/8/2021” as a date witch which it can work. You have to convert it into a date type using DATETIME_PARSE().

This should work:

IF(InvoiceDate<DATETIME_PARSE("03-08-2021", "DD-MM-YYYY"), 1, 2)


Hi @Databaser , thanks for your quick and good answer!

That has worked before. Now I immediately encountered another problem: I want to connect the IF function with another IF function.

If I do this as described below, the result is always “0”, even if the amount should be different.

Could you maybe help me again please? Thank you very much! :slightly_smiling_face:

IF(InvoiceDate<DATETIME_PARSE(“03-08-2021”, “DD-MM-YYYY”), (IF((SUM(PaymentAmount,{CurrencyDifference})/{InvoiceAmount})=1,0,{InvoiceAmount}-PaymentAmount)), 0)


Databaser
Forum|alt.badge.img+25
  • Brainy
  • August 4, 2021

Hi @Databaser , thanks for your quick and good answer!

That has worked before. Now I immediately encountered another problem: I want to connect the IF function with another IF function.

If I do this as described below, the result is always “0”, even if the amount should be different.

Could you maybe help me again please? Thank you very much! :slightly_smiling_face:

IF(InvoiceDate<DATETIME_PARSE(“03-08-2021”, “DD-MM-YYYY”), (IF((SUM(PaymentAmount,{CurrencyDifference})/{InvoiceAmount})=1,0,{InvoiceAmount}-PaymentAmount)), 0)


Try

IF(InvoiceDate<DATETIME_PARSE(“03-08-2021”, “DD-MM-YYYY”), IF(SUM(PaymentAmount,{CurrencyDifference})/{InvoiceAmount}=1,0,{InvoiceAmount}-PaymentAmount))


  • Author
  • New Participant
  • August 4, 2021

Try

IF(InvoiceDate<DATETIME_PARSE(“03-08-2021”, “DD-MM-YYYY”), IF(SUM(PaymentAmount,{CurrencyDifference})/{InvoiceAmount}=1,0,{InvoiceAmount}-PaymentAmount))


Hey @Databaser.

This working very well. Thank you so much!


Databaser
Forum|alt.badge.img+25
  • Brainy
  • August 4, 2021

Hey @Databaser.

This working very well. Thank you so much!


Glad I could help! Would yo mind marking my comment as the solution to your question? This helps others who may be searching with a similar question. Thanks!