Is it posible to aply a mask to a field?

paliman

Active Member
Joined
Jul 7, 2002
Messages
255
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?
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
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))
 
Upvote 0
Me too. And it works!!! :)
Thank you.

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

Forum statistics

Threads
1,214,646
Messages
6,120,720
Members
448,986
Latest member
andreguerra

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