Previous weeks - IF statement

bobcunnie

New Member
Joined
Jun 8, 2011
Messages
13
Can you help?

I want to use an IF function to look up a date field and if that date is within the last 2 weeks then the words "2 weeks" appears.


I have tried this but it is not working - can anyone advise...


=IF(CK8>NOW()-(2*7),"2 Weeks","")


Thanks
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
That should work..

Although you might try using TODAY instead of NOW..

Is CK8 actually a real date, or just a text string that looks like a date?

What does this return
=ISNUMBER(CK8)
 
Upvote 0
Describe "does not work"

Do you get an Error? What error?
Is the wrong result given, what result WAS given, what result did you expect?
What Date is in CK8?
 
Upvote 0
This is what I get

Migration Date</SPAN>Completed within last 2 weeks</SPAN>
31/03/2012</SPAN>
01/06/2012</SPAN>
30/06/2012</SPAN>2 Weeks</SPAN>
19/11/2012</SPAN>2 Weeks</SPAN>
30/09/2012</SPAN>2 Weeks</SPAN>
31/07/2012</SPAN>2 Weeks</SPAN>
31/07/2012</SPAN>2 Weeks</SPAN>
01/12/2011</SPAN>
01/12/2011</SPAN>
28/11/2011</SPAN>

<TBODY>
</TBODY><COLGROUP><COL><COL></COLGROUP>
Completion Date
</SPAN>
Completed within last 2 weeks</SPAN>
31/03/2012</SPAN>
01/06/2012</SPAN>
30/06/2012</SPAN> 2 Weeks</SPAN>
19/11/2012</SPAN> 2 Weeks</SPAN>
30/09/2012</SPAN> 2 Weeks</SPAN>
31/07/2012</SPAN> 2 Weeks</SPAN>
31/07/2012</SPAN> 2 Weeks</SPAN>
01/12/2011</SPAN>
01/12/2011</SPAN>
28/11/2011</SPAN>


This is what a get - all incorrect

<TBODY>
</TBODY><COLGROUP><COL><COL></COLGROUP>
 
Upvote 0
The formula is doing exactly what you told it to do..
It asks if the date in CK8 is Greater than a date 2 weeks ago.
Those date's that show 2 Weeks that you just posted, are all in the future.
So a date in the future, IS in fact greater than a date 2 weeks ago.

Perhaps you want
If CK8 is > 2weeksago AND < Today

Try
=IF(AND(CK8>=TODAY()-(2*7),CK8<=TODAY()),"2 Weeks","")
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,688
Members
448,978
Latest member
rrauni

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