Convert numbers to date 20220801 -> 01082022

Ipsy

New Member
Joined
Feb 4, 2025
Messages
5
Office Version
  1. 365
Platform
  1. Windows
Hello,

I have had a look through the forum but wasn't able to find an answer that worked for me, possible I didn't understand it either, I did end up with a lot of hashtags in my cell !

I am looking for a nice and easy way to convert a column of numbers from one format to another :

For example, I have 20220801, which is the way the date is presented in my file, but I need it to read 01082022 or 010822

Any help would be greatly appreciated.
 
It works !

I formatted the cell " jjmmaaa " and used the formula " =DATE(GAUCHE(A2;4);STXT(A2;5;2);DROITE(A2;2))"

I am very sorry about this, and a bit surprised because i didn't realise my Excel was in French, I use it quite a lot for basic formulas, I suppose because I could understand it I didn't notice which language it was in.

Thank you all again.
 
Upvote 0
I am very sorry about this, and a bit surprised because i didn't realise my Excel was in French, I use it quite a lot for basic formulas, I suppose because I could understand it I didn't notice which language it was in.
I think the error message you posted in post #3 kind of gave that away! ;)

Anyway, glad you got it working now!
 
Upvote 0
In my defense, so that I don't look like a complete numpty, my Excel used to accept formulas in French or English. I did have to reinstall Excel today so perhaps I didn't install it properly.
Or perhaps it's just been a long day. 😁

Thank you all again, I'm not sure which of your replies to note as the 'solution', it took teamwork.
 
Upvote 0
N.B. My system's Regional Settings include short date dd-mmm-yy

T202502a.xlsm
ABCD
1Data Formatdd-mmm-yyGeneralyyyymmdd
2
3202208011-Aug-224477420220801
4202208011-Aug-224477420220801
5
1e
Cell Formulas
RangeFormula
B3B3=--TEXT(A3,"0000-00-00")
C3C3=--TEXT(A3,"0000-00-00")
D3D3=--TEXT(A3,"0000-00-00")
B4B4=--TEXT(LEFT(A4,8),"0000-00-00")
C4C4=--TEXT(LEFT(A4,8),"0000-00-00")
D4D4=--TEXT(LEFT(A4,8),"0000-00-00")
This would work directly on all cells in the range...

=TEXT(TEXT(A3:A4,"0000-00-00"),"ddmmyyyy")

You could affix the double negative to the beginning to form real numbers, but you would lose the leading zero for days less than 10 (unless you formatted the cell with 00000000 of course).
 
Upvote 0
With current version of 365, we could use the following.
• check information on TrimRange
• only this data will be in Columns A,B, and/or C
• the text or number will be 8 or 7 digits 4 for Year, 2 for Month and 1 or 2 for Day
Format the dates to your preference



T202502a.xlsm
ABCD
1202208011-Aug-221-Aug-22
2202405055-May-245-May-24
3202502011-Feb-251-Feb-25
420250211-Feb-251-Feb-25
5202208011-Aug-221-Aug-22Text in A5
620250211-Feb-251-Feb-25Text in A6
72025050505N/A
1ee
Cell Formulas
RangeFormula
B1:B7B1=IFERROR(--TEXT(A.:.A,"0000-00-00"),IFERROR(--TEXT(A.:.A,"0000-00-0"),"N/A"))
C1:C7C1=IF(LEN(A.:.A)=8,--TEXT(A.:.A,"0000-00-00"),IF(LEN(A.:.A)=7,--TEXT(A.:.A,"0000-00-0"),""))
Dynamic array formulas.
 
Upvote 0
T202502a.xlsm
ABCDE
1ddmmyyyy
220220801010820220108202201082022
320240505050520240505202405052024
420250201010220250102202501022025
52025021010220250102202510022025
6202208010108202201082022Text in A601082022
720250210102202501022025Text in A710022025
82025050505N/A05052025
9
1ee
Cell Formulas
RangeFormula
B2:B8B2=IFERROR(--TEXT(A2:A8,"0000-00-00"),IFERROR(--TEXT(A2:A8,"0000-00-0"),"N/A"))
C2:C8C2=LET(d,A2:A8,IF(LEN(d)=8,--TEXT(d,"0000-00-00"),IF(LEN(d)=7,--TEXT(d,"0000-00-0"),"")))
E2:E8E2=--TEXT(LEFT(A2:A8&"0",8),"0000-00-00")
Dynamic array formulas.
 
Last edited:
Upvote 0
With current version of 365, we could use the following.
• check information on TrimRange
• only this data will be in Columns A,B, and/or C
• the text or number will be 8 or 7 digits 4 for Year, 2 for Month and 1 or 2 for Day
Format the dates to your preference



T202502a.xlsm
ABCD
1202208011-Aug-221-Aug-22
2202405055-May-245-May-24
3202502011-Feb-251-Feb-25
420250211-Feb-251-Feb-25
5202208011-Aug-221-Aug-22Text in A5
620250211-Feb-251-Feb-25Text in A6
72025050505N/A
1ee
Cell Formulas
RangeFormula
B1:B7B1=IFERROR(--TEXT(A.:.A,"0000-00-00"),IFERROR(--TEXT(A.:.A,"0000-00-0"),"N/A"))
C1:C7C1=IF(LEN(A.:.A)=8,--TEXT(A.:.A,"0000-00-00"),IF(LEN(A.:.A)=7,--TEXT(A.:.A,"0000-00-0"),""))
Dynamic array formulas.
Thank you for posting this... your mention of "current version" and "TrimRange" made me check and I see that I now have it in my version of Excel too! I have been waiting for the general release of this function/functionality for some time now and I am happy to see it finally has been released. I just wish Microsoft would be more proactive in letting the Excel world know when a new function or functionality has been released in general so we do not have to "trip over it by accident" or find out about it from others.
 
Upvote 0
Hi Rick
" have been waiting for the general release of this function/functionality for some time now and I am happy to see it finally has been released. I just wish Microsoft would be more proactive in letting the Excel world know when a new function or functionality has been released in general so we do not have to "trip over it by accident" or find out about it from others."

I agree 100%; communication could be much better.
 
Upvote 0

Forum statistics

Threads
1,226,771
Messages
6,192,919
Members
453,767
Latest member
922aloose

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top