Excel: If Date =, then enter a value [Solved/Closed]

Posts
2
Registration date
Thursday November 12, 2015
Status
Member
Last seen
November 12, 2015
- - Latest reply: BrianGreen
Posts
994
Registration date
Saturday January 17, 2015
Status
Moderator
Last seen
February 28, 2019
- Nov 13, 2015 at 12:42 PM
I am using this formula and it works well: =IF(A8=DATE(2015,3,27),"1","--")

How do I now create a string to check a number of dates (company holidays)?
See more 

2 replies

Best answer
Posts
994
Registration date
Saturday January 17, 2015
Status
Moderator
Last seen
February 28, 2019
318
2
Thank you
Would changing the enquiry help here ... instead of asking for a specific date then how about asking for ANY date? The expression then becomes...
=IF(ISNUMBER(A8),"1","0")
You then need to format cell A8 as a date.

Say "Thank you" 2

A few words of thanks would be greatly appreciated. Add comment

CCM 2496 users have said thank you to us this month

JerrySD
Posts
2
Registration date
Thursday November 12, 2015
Status
Member
Last seen
November 12, 2015
-
Thank you for the quick reply. I am so sorry I was unclear when I mentioned "company holidays". Since these are specific dates, "ANY" date will not work.
Posts
122
Registration date
Tuesday August 31, 2010
Status
Contributor
Last seen
June 20, 2016
24
1
Thank you
Brian is correct that you really shouldn't need to be entering hard-coded dates into formulas.

To achieve what you need.
1. Create a new sheet (called "CompanyDates") containing the dates that are deemed to be 'company holidays'
2 Enter this formula:
=IF(ISNA(MATCH(B2,CompanyDates!A:A,0)),"--",1)


This will check the date in cell B2 and return a '--' if the date is not in the company holiday list or 1 if it is.

Even if more dates are added to the list (next year) it will still work.
BrianGreen
Posts
994
Registration date
Saturday January 17, 2015
Status
Moderator
Last seen
February 28, 2019
318 -
Thanks Ray :)