date compare problem

johndem33

New Member
Joined
Apr 20, 2010
Messages
11
I need assistance in figuring out how to compare a literal to a cell that actually references another cell. My literal comparison is checking for which day of the week is in a cell. For example, let's say cell address 'A1' contains the date in the following format: 'day, month day, yyyy' format, like 'Tuesday, April 20, 2010'. Cell address 'A2' is a refence to '+A1' and 'A2' has been formatted using the Custom format of 'dddd'. So, 'A2' displays 'Tuesday'. In 'A3', I've entered the following formula: =If(A2="Tuesday","True","False"). My problem is the formula is returning 'False', but I can see that 'A2' is displaying 'Tuesday'! I suspect that the problem is I don't have an exact match in my formatting of 'A2' is likely masking it's real contents of 'Tuesday, April 20, 2010'. Is there a way to get around this and make my formula work?
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Hi

Welcome to the forum.

If you assign a cell to the value of another cell it retains the content of that cell irrespective of the formatting that you apply.

So, in this case A2 will be a Date.

Put the following in A3 to solve your problem :-

Code:
=(WEEKDAY(A1,2)=2)

hth

Mike
 
Last edited:
Upvote 0
Or

=IF(TEXT(A2,"dddd")="Tuesday",TRUE,FALSE)
<input id="gwProxy" type="hidden"><!--Session data--><input *******="jsCall();" id="jsProxy" type="hidden">
 
Upvote 0
Thank you three very much! I learned a lot this evening because of your assistance. Wishing you a fantastic day! :)

John in Dallas, Texas
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,120
Members
451,399
Latest member
alchavar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top