SamNew2Coding
New Member
- Joined
- Jun 15, 2020
- Messages
- 11
- Office Version
- 365
- Platform
- Windows
I have seen similar questions asked but have yet to find an answer for my circumstance. I have a Name Range (CDate) where a date is manually inputted into an excel file. I was using that name range in a formula to see if I should hide or show a column header. They are name ranges as well and are MonthEnd1, MonthEnd2, etc. I am slightly familiar from my research that excel records dates in a specific number format by default and formatting of the cells affects the comparison formula and can cause errors. Since I have data being imported to this template and have the name range values (CDate) changing here and there with each import, i was trying to see if i there is a way to do the date comparison in a formula regardless of that cells format.
This is what I've tried originally
=MonthEnd1<CDate,"",MonthEnd1
This seemed to have errors so i tried playing around with having the formula see them both as dates as its calculating but that didnt seem to work too well either
=IF(TEXT(MonthEnd1,"mm/dd/yyyy")<TEXT(CDate,"mm/dd/yyyy"),"",TEXT(MonthEnd1,"mm/dd/yyyy")
I have tried changing the cell format to be 'Short Date' for both name ranges (CDate and MonthEnd1) but still encounter issues. Anyone have any advice?
This is what I've tried originally
=MonthEnd1<CDate,"",MonthEnd1
This seemed to have errors so i tried playing around with having the formula see them both as dates as its calculating but that didnt seem to work too well either
=IF(TEXT(MonthEnd1,"mm/dd/yyyy")<TEXT(CDate,"mm/dd/yyyy"),"",TEXT(MonthEnd1,"mm/dd/yyyy")
I have tried changing the cell format to be 'Short Date' for both name ranges (CDate and MonthEnd1) but still encounter issues. Anyone have any advice?