Solved

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

Posted on 2011-03-03
4
230 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
ID: 35031216
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
ID: 35031232
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
ID: 35031261
...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
ID: 35036679
Barry, you are a genie!!

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

Gary
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
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 two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

820 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