Get Date from one cell to format another, then...

M

MattyO

I want to take/copy/whatever? the date from a particular cell in the format
DD-MMM-YYYY, from there I want to format that date into MMM-YY into another
cell. After that has been complete, take that formatted date and auto fill 6
more columns with the past 6 months.

Another way to look at it:

(Take Cell A1) 18-JUN-2008 >> (Format Cell D1 like this) JUN-2008 >> (Then
auto fill F1:L1)JUN-2008 to JAN-2008

Please help.
 
R

Rick Rothstein \(MVP - VB\)

Assuming you want a more general solution involving columns rather than a
single instance. Using your posted samples, select Column D and use Format
Cells with this custom format pattern, "mmm-yy" (assuming your example
incorrectly shows a 4-digit year when your text description said you want a
2-digit year), then select Columns F thru L and use Format Cells to custom
format them using this custom format pattern, "mmm-yyyy". Next, put this
formula in D1...

=IF(A1<>"",A1,"")

Then put this formula in F1...

=IF(A1<>"",A1,"")

And put this formula in G1 and *copy* it across to L1...

=IF(A1<>"",F1+1,"")

Then select D1 and F1 thru L1 and *copy* them down as far as you like.

Rick
 
R

Rick Rothstein \(MVP - VB\)

What I provided you is not code... those are worksheet formats (Format/Cells
from Excel's menu bar) and worksheet formulas (type them into the cells
where I indicated).

Rick
 
M

MerleSmith

Do you cross year boundaries? e.g. startdate of FEB-2008, which would cross
back into 2007. This makes the problem a little more complex.
 
M

MattyO

Yes, it can cross into year boundaries. To provide further detail, I am
trying to add this additional code into an existing macro to handle some
additional formatting of a report that could be run every month. Apologies
for not adding these further details earlier.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top