date formula

mccallda

New Member
Joined
May 20, 2011
Messages
3
hi, i know this may be simple but i could really do with some help. i am trying to write a formula where whatever date i write, the formula will tell me what the date would be the previous tuesday. i have seen some pages talk about VBA coding, but i do not understand writing code, unless someone can write a quick crash course on this? any help would be great,
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Hi,

Welcome to the forum.

Assuming you are entering dates in A1, maybe this

Formula in B1
=IF(WEEKDAY(A1)>3,A1-WEEKDAY(A1)+3,A1-WEEKDAY(A1)-4)

HTH

M.
 
Upvote 0
You can get the same answer with this formula

=A1-WEEKDAY(A1-3)

That will give the same results as Marcelo and Haseeb's suggestions. If A1 is a Tuesday date it gives the date 7 days before, if you want to return the same date as A1 in that scenario then change to this version

=A1+1-WEEKDAY(A1-2)
 
Upvote 0

Forum statistics

Threads
1,224,505
Messages
6,179,153
Members
452,891
Latest member
JUSTOUTOFMYREACH

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