Is it posible to aply a mask to a field?

paliman

Active Member
Joined
Jul 7, 2002
Messages
254
Hi all. Here's my problem.
I need to type lots of invoices numbers in order to generate a tax report. Due to requirements of our tax administration department, they should be formatted as ####-########
Most of the times, only the last digit before the "-" and the last 3 or 4 digits will have a value while the rest will be zeros.Something like:
0001-00000123
0001-00004563
0000-00000650
Obviously, I'd like to just type 1-123; 1-4563 and 0-650
If I had to do it in access, I would simply aply a mask to the field. Is there a way to make this in excel? Any ideas?
Adding an extra column and using a formula perhaps?
 

Some videos you may like

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.

Asala42

Well-known Member
Joined
Feb 26, 2002
Messages
2,318
Not exactly pretty, but how about typing your shorthand way in one column and copying this formula nearby (you may have to format your input column as text):

=REPT("0",5-FIND("-",A3))&LEFT(A3,FIND("-",A3)-1)&"-"&REPT("0",8-(LEN(A3)-FIND("-",A3)))&RIGHT(A3,LEN(A3)-FIND("-",A3))
 

paliman

Active Member
Joined
Jul 7, 2002
Messages
254
Me too. And it works!!! :)
Thank you.

I have to go home now. Happy weekend to everyone!!!
 

Watch MrExcel Video

Forum statistics

Threads
1,123,324
Messages
5,600,956
Members
414,417
Latest member
Nobu

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
Top