Custom Format with slashes between number

howard

Well-known Member
Joined
Jun 26, 2006
Messages
6,603
Office Version
  1. 2021
Platform
  1. Windows
I have a number 19920195872597


I need a to format this as 1992/01958725/97


It would be appreciated if someone could assist me using a custom format
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Assuming all your entries are the same length, this Custom Format should work:
Code:
000\/00000000\/00
 
Upvote 0
It's funny how that there are 14 characters in the 19920195872597
and there are ONLY 13 characters in your Custom Format;
Further the format seems to set out ONLY 3 characters before the "\ /"
So where's the logic in this? It works fine!!

Tks -- Jim
 
Upvote 0
That was a typo, I meant to type:
Code:
0000\/00000000\/00
However, it is formatting from the right to left, just like if you did a number and wanted to custom format where to place the commas for the thousands places.
So you could actually use this and it would still work:
Code:
0\/00000000\/00
Just as long as you have at least one zero before the first slash.
 
Upvote 0
jim may - good question.

I experimented with variations on Joe4's suggestion - these all give the same result, at least for the given input value

0\/00000000\/00
00\/00000000\/00
0000\/00000000\/00

I think this gives a clue as to how Excel is working this out - it's reading from the right and inserting a "/" before the last two characters, and so on.

This variation
00000\/00000000\/00
gives this result
01992/01958725/97
in other words padding with zeroes.

Edit to add - Oops - too slow ! :-)
 
Last edited:
Upvote 0
thanks Joe & Gerald


Your custom formatting works perfectly
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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