0
I am using an IF
function to insert a string into a cell if the cell specified is #N/A
, the function works if I use the following
=IF(AS2="#N/A","",CONCATENATE("insert in tempTable values('",AQ2,"','",AR2,"')"))
where AR2
is the date, here are the two different strings I am being returned
insert in tempTable values('BIXEN V VASILE ALIN GEORGESCU','19/3/2012')
insert in tempTable values('BANEKIOSKEN V MUHAMMAD NASEEB KHAN','41003')
the problem is some of the dates are ok where others are in the date serial number format so I am trying to use the TEXT
function to change this on the following function it is not working
=IF(AS2="#N/A","",CONCATENATE("insert in tempTable values('",AQ2,"','",TEXT(AR2,d/m/yyyy),"')"))
i have also tried
=IF(AS2="#N/A","",CONCATENATE("insert in tempTable values('",AQ2,"','",IF(AR2=d/m/yyyy,AR2,TEXT(AR2,d/m/yyyy)),"')"))
Does anyone see what I am doing wrong?
EDIT: here is the formula working
=IF(AS2="#N/A","",CONCATENATE("insert in tempTable values('",AQ2,"','",IF(AR2="d/m/yyyy",AR2,TEXT(AR2,"d/m/yyyy")),"')"))
Surely AR2 won't ever be equal to "d/m/yyyy" (which is what you are checking - it isn't checking the format). If AR2 is a "date" in text format then TEXT function won't change it. I'd try this version
=IF(ISNA(AS2),NA(),CONCATENATE("insert in tempTable values('",AQ2,"','",TEXT(AR2,"d/m/yyyy"),"')"))
That will also explicitly return #N/A which is "cleaner" than allowing the error, I think – barry houdini – 2012-09-18T10:22:42.720