This will make Excel take the date inside double quotes as a serial number, and use it in the logical test without having its value changed. Another neat technique that you can use is to simply add a zero to the date (which has been enclosed in double quotes).Alternatively, you can use the DATEVALUE function as explained in the first part of this tutorial.For example, instead of typing =IF(A2<””,”done”,”not done”), you can store the date in a cell, say B2 and type the formula: =IF(A2 Having discussed different ways to use dates with the IF function, here are some important points to remember: You can use the IF function along with the TODAY function in cell B2 as follows: =IF(A2 This means, adding n number of days to a date is equivalent to adding the value n to the serial number that the date represents. So, the serial number 2 corresponds to Jan 2, 1900, and so on. This is because dates are basically stored in Excel as serial numbers, starting from the date Jan 1, 1900.Įach day after that is represented by one whole number. Using the IF Function with Future or Past DatesĪn interesting thing about dates in Excel is that you can perform addition and subtraction operations with them too. Here’s a screenshot to illustrate the effect of the above formula (assuming the current date is ): You can use the IF function along with the TODAY function in cell B2 as follows: =IF(A2 So you cannot use a logical test as “>” in your IF function, as it will simply see the value “ ” as text. It interprets them as regular text values. Unfortunately, unlike other Excel functions, the IF function cannot recognize dates. It may look like IF formulas for dates are the same as IF functions for numeric or text values, since they use the same comparison operators. Here are some of the comparison operators that you can use when comparing dates, along with what they mean: Symbol Unlike numbers and strings, comparison operators when used with dates, have a slightly different meaning. You can then use the IF function as follows: =IF(A2=10,"yes","no") value_if_false is the value that you want the IF function to return if the logical_test evaluates to FALSEįor example, say you want to write a statement that will return the value “ yes” if the value in cell reference A2 is equal to the 10, and “ no” otherwise.value_if_true is the value that you want the IF function to return if the logical_test evaluates to TRUE.The result of this parameter is either TRUE or FALSE logical_test is the condition or criteria that you want the IF function to test.The syntax for the IF function is as follows: IF( logical_test,, ) Using the IF Function with Future or Past Dates.Using the IF Function with the TODAY Function.Using the IF Function with DATEVALUE Function.#Excel if then formula with numbers serial number