Automatically prefixing a cell's data

nortellini

New Member
Joined
May 13, 2004
Messages
28
Hi all

Another simple query from Mr Basic ;)

Can I ask if anyone would kindly tell me how I may prefix every cell I input?

Example:

I am type in "1976" in A1, but I would like it to read "MAIN1976" when I press enter.

How do I automatically do that folks?

Any help would be greatly appreciated!

Thanks

Chris
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Chris

If you are inputting numbers and you wish to display them as "MAIN1976" say, then you can use a custom number format:

Select the cells, go Format>Cells and on the number tab go to Custom and in the bar in the top right, type:

"MAIN"0

and hit OK.

Any numbers will then be prefixed by "MAIN" for display purposes only (so that you can continue to sum numbers for example). This will not be applied to text that you type into the cells, however, such as "Car" which will remain as "Car".

If you want to apply hte "MAIN" to text entries as well, you will need a VBA solution.

Hope this helped!

Richard
 
Upvote 0

Forum statistics

Threads
1,213,491
Messages
6,113,963
Members
448,536
Latest member
CantExcel123

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