Solved

Passing date as text in different format in Excel

Posted on 2011-03-23
7
314 Views
Last Modified: 2012-05-11
Hello,

I need to take todays date and add it to the end of a function as itself in a separate format, then I need to take the date from a month ago, from 6 months ago, and from 12 months ago and do the same thing. This isn't very clear and is best illustrated with an example.

I have a date:

=TODAY()      -> 3/23/2011

I need this date to become a text string in the form of:

CellA1: 20110323

which gets added to some text in a function:

="TEXT="&A1

Which should result in my final text becoming "TEXT=20110323"

I then need to do this for a month ago and 6 months ago and a year ago.

Right now I create the date =TODAY() in the format yyyymmdd, but when I add this to the end of my string, it becomes 40625, the converted Microsoft date.

Thanks!
0
Comment
Question by:keats88
  • 3
  • 2
  • 2
7 Comments
 
LVL 81

Accepted Solution

by:
zorvek (Kevin Jones) earned 500 total points
ID: 35201278
Any date can be formatted as you desire with:

   TEXT(Date, "YYYYMMDD")

Kevin
0
 
LVL 81

Expert Comment

by:zorvek (Kevin Jones)
ID: 35201337
To find dates so many months in the past use the EDATE function:

EDATE(StartDate, Months) - Returns the date time serial number of the date that is the indicated number of months before or after the parameter StartDate. Requires the Analysis Toolpak.

Kevin
0
 

Author Closing Comment

by:keats88
ID: 35201341
Oh man, that worked. I have no idea why I thought it wouldn't and didn't bother trying it. Thanks
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 39

Expert Comment

by:nutsch
ID: 35201342
And to get to the 3, 6 12 months ago, your best bet is to install the analysis toolpak add-in and use the edate formula. So with Kevin's suggestion

=text(edate(today(),-6),"YYYYMMDD")

will give you the date 6 months ago, as text in the right format

Thomas
0
 
LVL 81

Expert Comment

by:zorvek (Kevin Jones)
ID: 35201351
So, to do what you want with a date six months in the past:

="TEXT="&TEXT(EDATE(NOW(),-6),"YYYYMMDD")

Kevin
0
 

Author Comment

by:keats88
ID: 35201554
Thanks guys, this other stuff is helpful too, I wish I hadn't already picked the solution so I could give you guys some points. Sorry :-(
0
 
LVL 39

Expert Comment

by:nutsch
ID: 35201617
Most of the you guys are the one you accepted the solution of, so I guess you're fine.

T
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
Viewers will learn the basics of slicers and timelines for both PivotTables and standard Excel tables in Excel 2013.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now