Joseph Michael Pesch
VP Programming

Excel Formula to Convert Date Cell to Text Cell

by 13. March 2009 15:22

This formula will take the Date value from cell A1 and convert it to either the word null if no date is in the cell or a string representation of the date in small quotes (usefull for generating SQL insert/update strings):

=IF(A1="","null","'"&TEXT(MONTH(A1),"00") & "-" & TEXT(DAY(A1),"00") & "-" & TEXT(YEAR(A1), "0000")&"'")

Tags: ,


Comments are closed