Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 1
Default Excel 2003 Find and Replace

I have a column of numbers. Some numbers vary in the number of characters
and some are strickly numbers; others are a mix of numbers and letters. I
would like to replace those numbers with the same numbers but with
parenthesis around each of them. How do I do that?
  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 22,906
Default Excel 2003 Find and Replace

Paste a representative sample of your data into a post so's we can have a look.


Gord Dibben MS Excel MVP

On Sun, 2 Dec 2007 12:20:01 -0800, jr0410
wrote:

I have a column of numbers. Some numbers vary in the number of characters
and some are strickly numbers; others are a mix of numbers and letters. I
would like to replace those numbers with the same numbers but with
parenthesis around each of them. How do I do that?


  #3   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 5,651
Default Excel 2003 Find and Replace

On Sun, 2 Dec 2007 12:20:01 -0800, jr0410
wrote:

I have a column of numbers. Some numbers vary in the number of characters
and some are strickly numbers; others are a mix of numbers and letters. I
would like to replace those numbers with the same numbers but with
parenthesis around each of them. How do I do that?


If I understand you correctly, you would want the string:

ab12ab33

to change to:

ab(1)(2)ab(3)(3)

This UDF will do that.

To enter the UDF, <alt-F11 opens the VBEditor. Ensure your project is
highlighted in the Project Explorer window, then Insert/Module and paste the
code below into the window that opens.

To use this function, enter a formula of the type:

=parennums(A1)

If you want different functionality, it's pretty easy to change this. Post
back.

================================
Option Explicit
Function ParenNums(str As String) As String
Dim re As Object
Set re = CreateObject("vbscript.regexp")
re.Global = True
re.Pattern = "(\d)"
ParenNums = re.Replace(str, "($1)")

End Function
==============================================
--ron
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find & Replace Option in Excel 2003 RachelN Setting up and Configuration of Excel 0 April 20th 06 05:44 PM
Excel 2003 Find and Replace is changed to previovois ver.-awful!! Tvermoes Excel Discussion (Misc queries) 3 August 24th 05 01:48 PM
find and replace links in Excel 2003 MAndrews Excel Worksheet Functions 2 June 3rd 05 06:18 PM
Find and replace Excel, Office pro 2003 bval Excel Discussion (Misc queries) 6 January 28th 05 11:24 PM
Find and replace for comments in excel 2003 omprakash Excel Discussion (Misc queries) 1 January 28th 05 05:55 AM


All times are GMT +1. The time now is 08:39 AM.

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

About Us

"It's about Microsoft Excel"