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
 

Some videos you may like

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
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)
 

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
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?
 

bobcunnie

New Member
Joined
Jun 8, 2011
Messages
13

ADVERTISEMENT

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>
 

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
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","")
 

Watch MrExcel Video

Forum statistics

Threads
1,122,517
Messages
5,596,620
Members
414,081
Latest member
Subaru_Steve

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
Top