简体   繁体   中英

Excel custom date format not showing in formula bar and pivot table

I'm trying to override the date format of cells that is 01/10/2018 to Jan/10/2018 in a sheet that is the pivot table source. In the cells, it shows Jan/10/2018, but in the formula bar it shows 01/10/2018.

In the pivot table it also shows 01/10/2018 even when overriding it with a macro.

I tried using an apostrophe in front of the Jan/10/2018 but then I get a 46772 number in the cell.

Any ideas? Please help!

One problem: The data is cleaned on opening in VBS so I cannot use a formula manually

Sub Format_Date ()

Selection.NumberFormat = "mmm-dd-yyyy"

End Sub

Try applying this code to your date and it should do the work.

In the Formula Bar, a date will show according to your computer's setting for the "Short date".

In Control Panel > Clock, Language and Region > Region and Language you can set these defaults for your computer.

The Excel "short date" format will always be displayed in the formula bar. In the screenshot below, you can see my regional settings. The Excel cell has today's date, formatted as a "Long Date". The formula bar shows the "Short date", which is determined by the computer's regional settings.

So, no, you cannot change the way the date shows in the formula bar, unless you are prepared to change your computer settings for "short date". This will then apply to all applications that use that date format, which may be way more than just Excel.

点击此链接获取图片示例

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM