ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Extract Date (04/05/06) into Text (040506) (https://www.excelbanter.com/excel-programming/364196-extract-date-04-05-06-into-text-040506-a.html)

Who I Am

Extract Date (04/05/06) into Text (040506)
 
I need a formula or a VBA code to extract a date into a string. Could
you shed a light?

Thanks in advance.


Ron Coderre

Extract Date (04/05/06) into Text (040506)
 
Perhaps something like this:

For a date in A1

B1: =TEXT(A1,"mmddyy")

You might also be able to just use a custom number format

Select A1
<format<cells<number tab
Category: Custom
Type: mmddyy
Click the [OK] button

Is that something you can work with?
***********
Regards,
Ron

XL2002, WinXP


"Who I Am" wrote:

I need a formula or a VBA code to extract a date into a string. Could
you shed a light?

Thanks in advance.



AA2e72E

Extract Date (04/05/06) into Text (040506)
 
Or, try:

replace(yourDateVaraibleOrvalue,"/","")




ward376

Extract Date (04/05/06) into Text (040506)
 
=LEFT((TEXT(A1,"MM/DD/YY")),2)&MID((TEXT(A1,"MM/DD/YY")),4,2)&RIGHT((TEXT(A1,"MM/DD/YY")),2)


ward376

Extract Date (04/05/06) into Text (040506)
 
=LEFT((TEXT(A1,"MM/DD/YY")),2)&MID((TEXT(A1,"MM/DD/YY")),4,2)&RIGHT((TEXT(A1,"MM/DD/YY")),2)


ward376

Extract Date (04/05/06) into Text (040506)
 
=LEFT((TEXT(A1,"MM/DD/YY")),2)&MID((TEXT(A1,"MM/DD/YY")),4,2)&RIGHT((TEXT(A1,"MM/DD/YY")),2)


ward376

Extract Date (04/05/06) into Text (040506)
 

oops, double post

This formula will give you mmddyy as text as long as excel recognizes
it as a date regardless of format. Even if it's formatted as a number,
general etc.



All times are GMT +1. The time now is 11:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com