Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

date formula looking

Forum home » Delegate support and help forum » Microsoft Excel Training and help » Date formula - looking to return a weekday in 3/6 months in the

Date formula - looking to return a weekday in 3/6 months in the

ResolvedVersion 2003

Mieke has attended:
Excel VBA Intro Intermediate course
Taking Minutes course

Date formula - looking to return a weekday in 3/6 months in the

Hi there

I need to calculate an end date which is my start date + 6 months, but I want excel to return the Friday before this end date.

So far my e start date in cell C10 which 19/03/2012. I've calculated my end date in D10 as =DATE(YEAR(C10),MONTH(C10)+6,DAY(C10)-1). This returns the date of 18/09/2012 which is perfect except I'd like the Friday before which is 14/09/2012. I've tried using an if and a weekday but can't seem to get it right

Could you help me please?
Thank you!

RE: Date formula - looking to return a weekday in 3/6 months in

Hello Mieke,

Hope you enjoyed your Microsoft Excel Advanced course with Best STL.

Thank you for your question regarding using a date formula.

I'm not exactly sure why you want the result to be a Friday and also you have not provided sufficient information for me to reply with an exhaustive formula that covers all angles.

So, what I have done is provide you with a formula that changes the result you are presently getting (Tuesday) to the Friday before. I changed your formula to the following:

=IF(WEEKDAY(C10)=2,DATE(YEAR(C10),MONTH(C10)+6,DAY(C10)-5),DATE(YEAR(C10),MONTH(C10)+6,DAY(C10)-1))

Depending on your reasons for producing the result you require, it is possible that you will need another 6 more nested IFs each of which will examine the weekday number and subtract a value to bring the result to a Friday.


I hope this resolves your question. If it has, please mark this question as resolved.

If you require further assistance, please reply to this post. Or perhaps you have another Microsoft Office question?

Have a great day.
Regards,

Rodney
Microsoft Office Specialist Trainer

Excel tip:

Use RANDBETWEEN to generate random numbers

There may be occassions where you need to generate random numbers in your spreadsheet. Use the RANDBETWEEN function to generate random numbers between two values that you specify.

The function looks like this:

=randbetween(LOW,HIGH)

where LOW is the lowest number you want generated; and HIGH is the highest number you want generated.

This formula will work with both positive and negative LOWs and HIGHs. Also it will only generate integer numbers unless forced to do otherwise by the following:

=randbetween(LOW*10^PRECISION,
HIGH*10^PRECISION)/(10^PRECISION).

where PRECISION represents the levels of decimal precision needed (i.e. if you need numbers with one decimal place, PRECISION would be 1; 2 for two decimal places and so on).

One final note, if the RANDBETWEEN formula does not work in your spreadsheet or returns a "#NAME" error, you need to install the Analysis Toolpak Add-In. You will need to press F2 then Enter following the installation.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.11 secs.