Solved

How to extract a WorkSheet Name and have it then formatted as a date field.

Posted on 2011-03-03
4
202 Views
Last Modified: 2012-05-11
Hello again Experts, I need your help.

I want to extract a WorkSheet Name (eg. 02-24-2011) into a cell and have it then formatted as a date field (eg. mm/dd/yyyy).

I use this formula in the cell to extract the WorkSheet Name:
=MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,255)

However, even though I format the cell to be (mm/dd/yyyy), the result is still 02-24-2011 and not recognized as a date.

Is there anything I can do to work around this?

Gary
0
Comment
Question by:garyrobbins
  • 2
4 Comments
 
LVL 14

Expert Comment

by:theras2000
Comment Utility
You can't just tell text to be a date.  You have to use the DATE() function, and feed it the 3 individual numbers - year, month, day - then Excel will see it as a proper date.
Assuming that your previous formula is in B1, you could use this formula in another cell.
=DATE(RIGHT(B1,4),LEFT(B1,2),MID(B1,4,2))
You could also merge your previous formula into it to make one huge formula, but that'd get pretty messy.
0
 
LVL 50

Accepted Solution

by:
barry houdini earned 500 total points
Comment Utility
Try using your original formula with +0 at the end, that will convert the text to a date

=MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,255)+0

format as required

regards, barry
0
 
LVL 50

Expert Comment

by:barry houdini
Comment Utility
...another way would be to use DATEVALUE function....but you get the same result

=DATEVALUE(MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,255))

barry
0
 

Author Closing Comment

by:garyrobbins
Comment Utility
Barry, you are a genie!!

Thank you, again, for your fast and engenious response.

Gary
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

A2 = A1 That kind of cell reference is relative.  If you copy it from A2 to B2, then B2 will get this: B2 = B1 That's all fine and good, but if you then insert a new row above row 2, you'll find: A3 = A1 B3 = B1 This is intentional. …
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

771 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