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
 

Some videos you may like

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

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
 

Watch MrExcel Video

Forum statistics

Threads
1,119,129
Messages
5,576,267
Members
412,710
Latest member
Maged elmasry
Top