THIS IS EXPLICIT FOR MAC, I did not clarify this initially.
I get a CSV file from a reporting system and I take some parts of that data and paste it to another Excel file where a macro uses a formula to get the difference from one date provided from the CSV compared to the date today.
Cell L19 is where the data from the CSV file is going
Some days the data looks like this:
04/03/2016 00:00 , for this, the following formula works > =IF(OR(ISERROR(I19),ISBLANK(I19)),"", DATEDIF(L19,TODAY(),"Y"))
At other days the data looks like > 04/03/2016 10:34 AM and the following formula works:
=IF(OR(ISERROR(I3),ISBLANK(I3)),"", DATEDIF(DATE(RIGHT(SUBSTITUTE(LEFT(L3,FIND(" ",L3)-1),"/","$",1),4),LEFT(SUBSTITUTE(LEFT(L3,FIND(" ",L3)-1),"/","$",1),FIND("$",SUBSTITUTE(LEFT(L3,FIND(" ",L3)-1),"/","$",1))-1),MID(SUBSTITUTE(LEFT(L3,FIND(" ",L3)-1),"/","$",1),FIND("$",SUBSTITUTE(LEFT(L3,FIND(" ",L3)-1),"/","$",1))+1,FIND("/",SUBSTITUTE(LEFT(L3,FIND(" ",L3)-1),"/","$",1))-FIND("$",SUBSTITUTE(LEFT(L3,FIND(" ",L3)-1),"/","$",1))-1)),TODAY(),"Y"))
Is there a way to cover both cases in the same Cell formula?
Bookmarks