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

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Richard Schollar

MrExcel MVP
Joined
Apr 19, 2005
Messages
23,707
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
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,633
Messages
5,832,780
Members
430,167
Latest member
Gogogoben

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