A Microsoft Excel forum. ExcelBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » ExcelBanter forum » Excel Newsgroups » Excel Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Insert a letter in front of number in every cell?



 
 
Thread Tools Display Modes
  #1  
Old October 6th 07, 07:49 PM posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Insert a letter in front of number in every cell?

I have a whole column of numbers which I would like to add a letter to
in the beginning. For example, if the cell has the number 2350, I
would like to change the cell to B2350. How do I do this without
manually changing the data on every cell?

Ads
  #2  
Old October 6th 07, 07:56 PM posted to microsoft.public.excel.worksheet.functions
David Biddulph[_2_]
external usenet poster
 
Posts: 8,651
Default Insert a letter in front of number in every cell?

="B"&A1 and copy down.
--
David Biddulph

> wrote in message
ups.com...
>I have a whole column of numbers which I would like to add a letter to
> in the beginning. For example, if the cell has the number 2350, I
> would like to change the cell to B2350. How do I do this without
> manually changing the data on every cell?
>



  #3  
Old October 6th 07, 09:22 PM posted to microsoft.public.excel.worksheet.functions
T. Valko
external usenet poster
 
Posts: 15,768
Default Insert a letter in front of number in every cell?

You can do it in one operation with a macro.

Hit ALT F11 to open the VB editor
Hit CTRL R to open the project exlporer
Locate your file name in the explorer pane
Select the file name and right click
Select Insert>Module
Paste the code below into the window that opens on the right:

Sub AddB()

Dim cell As Range
For Each cell In Selection
If cell.Value <> "" Then
cell.Value = "B" & cell.Value
Else: cell.Value = cell.Value
End If
Next cell
End Sub

Close the VB editor to return to Excel

Select the range of cells of interest
Goto Tools>Macro>Macros
Select the AddB Macro and click Run



--
Biff
Microsoft Excel MVP


> wrote in message
ups.com...
>I have a whole column of numbers which I would like to add a letter to
> in the beginning. For example, if the cell has the number 2350, I
> would like to change the cell to B2350. How do I do this without
> manually changing the data on every cell?
>



  #4  
Old October 8th 07, 02:50 PM posted to microsoft.public.excel.worksheet.functions
Darren Bartrup[_2_]
external usenet poster
 
Posts: 36
Default Insert a letter in front of number in every cell?

If you want the number to stay as a number you could give the cell a custom
number format.
[>1000]"B"#;[<=1000]"C"#;General

Anything over 1000 will be prefixed with a B, anything under or equal to
1000 will be prefixed with a C.

"T. Valko" wrote:

> You can do it in one operation with a macro.
>
> Hit ALT F11 to open the VB editor
> Hit CTRL R to open the project exlporer
> Locate your file name in the explorer pane
> Select the file name and right click
> Select Insert>Module
> Paste the code below into the window that opens on the right:
>
> Sub AddB()
>
> Dim cell As Range
> For Each cell In Selection
> If cell.Value <> "" Then
> cell.Value = "B" & cell.Value
> Else: cell.Value = cell.Value
> End If
> Next cell
> End Sub
>
> Close the VB editor to return to Excel
>
> Select the range of cells of interest
> Goto Tools>Macro>Macros
> Select the AddB Macro and click Run
>
>
>
> --
> Biff
> Microsoft Excel MVP
>
>
> > wrote in message
> ups.com...
> >I have a whole column of numbers which I would like to add a letter to
> > in the beginning. For example, if the cell has the number 2350, I
> > would like to change the cell to B2350. How do I do this without
> > manually changing the data on every cell?
> >

>
>
>

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
blank spaces in front of a number prevents formatting cell Teri Excel Discussion (Misc queries) 2 April 10th 07 09:28 PM
HOW DO I ADD A LETTER BEFORE AN EXISTING NUMBER IN A CELL? PAULP Excel Worksheet Functions 8 January 27th 06 07:16 PM
change headers from letter to number/number to letter lazybee Excel Worksheet Functions 1 July 29th 05 11:08 PM
how to add a letter in front of each number in a cell nmodafferi Excel Discussion (Misc queries) 15 June 16th 05 08:58 PM
column header changed from letter to number, how return to letter Ron Excel Discussion (Misc queries) 2 May 9th 05 08:34 PM


All times are GMT +1. The time now is 08:20 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 2004-2014 ExcelBanter.
The comments are property of their posters.