How remove date formatting but keep same numerals in order yyyymmdd

xcellerator

New Member
Joined
Feb 22, 2017
Messages
23
Office Version
  1. 2019
Platform
  1. MacOS
I have a file with a column for date (maybe 10k rows or so).
Within that column I would like all the cells to be unformatted and appear in the style 20231127 (order: year then month then date).

I have 3 different situations (at least...)
1.
Some of the cells are Format->Custom->yyyymmdd, and appear as 20231126, for example, but when I select the cell it appears as 11/26/2023
So, when I remove the formatting (which I think I would do by selecting the cell and then going to Edit->Clear-Formats), the date/number then changes into 45256.

2.
Some of the cells are Format->Custom->yyyymmdd, and appear as 20231125, for example, and when I select the cell it still appears as 20231125

3.
Other cells are Format->General, and appear as 20231124, and when I select the cell it appears as 20231124.

My goal is to remove the formatting for all dates and still have the cell appear as 20231126 (and not 45256). Sounds simple (and I'm sure it is...) but for the life of me I can't figure it out! 😬
Thanks in advance of any help!
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
you can use formula to split year, month, date and paste its as values:
Excel Formula:
=TEXT(YEAR("date"),"0000")&TEXT(MONTH("date"),"00")&TEXT(DAY("date"),"00")
 
Upvote 0
Thank you @eiloken . That seems to work, but in the case where the formula is being applied to every row, and I do not know the format of the cell, if the cell has the data 20231125 in it and I use the formula, it will return #NUM! (case #3, above..and maybe #2 also?)

Is there a way to get it to "ignore" the data if it is already in the cell as 20231125 so I can leave those cells "as is" and will remain as 20231125 once I clear formatting?
Thank you again -
 
Upvote 0
=IF(--A1<19000101,--(TEXT(A1,"yyyymmdd")),--A1)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,084
Messages
6,123,029
Members
449,092
Latest member
ikke

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