Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-17-2011, 09:19 PM
Griff's Avatar
Griff Griff is offline Find & Replace formula for numbers? Mac OS X Find & Replace formula for numbers? Microsoft Office 2008 for Mac
Novice
Find & Replace formula for numbers?
 
Join Date: Apr 2011
Posts: 3
Griff is on a distinguished road
Default Find & Replace formula for numbers?

Is there a formula for Find & Replace? Specifically for replacing numbers with other numbers?

I have a document with 11 pages of various number combinations that look a bit like this:



A-1, 6, 7, 8
A-3, 8, 1, 2
A-5, 2, 3, 4
A-7, 4, 5, 6

I need to change all the instances of...
"1" to "8"
"2" to "1"
"3" to "2"
"4" to "3"
And so on...

I would do a simple Find & Replace, but by the time I get to the final one (which is changing "8" to "7") the Find function will locate all the "8" including the ones which used to be "1". Get me?

So if there were a function or formula that could just subtract 1 from the value I'd be set.
Reply With Quote
  #2  
Old 04-18-2011, 12:31 AM
macropod's Avatar
macropod macropod is offline Find & Replace formula for numbers? Windows 7 32bit Find & Replace formula for numbers? Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Griff,

Try the following macro:
Code:
Sub Renumber()
Dim i As Long
For i = 1 To Selection.Words.Count
  With Selection.Words(i)
    If IsNumeric(.Text) Then
      .Text = (CLng(.Text) + 6) Mod 8 + 1
    End If
  End With
Next
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 04-18-2011, 01:13 AM
Griff's Avatar
Griff Griff is offline Find & Replace formula for numbers? Mac OS X Find & Replace formula for numbers? Microsoft Office 2008 for Mac
Novice
Find & Replace formula for numbers?
 
Join Date: Apr 2011
Posts: 3
Griff is on a distinguished road
Default

Awesome, thanks!
Reply With Quote
  #4  
Old 04-18-2011, 01:43 AM
macropod's Avatar
macropod macropod is offline Find & Replace formula for numbers? Windows 7 32bit Find & Replace formula for numbers? Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Griff,

I just realised your profile says you're using Office 2008 ... which doesn't support macros. The same result could be achieved with a series of Find/Replace operations:
Find = 1
Replace = 0
Find = 2
Replace = 1
Find = 3
Replace = 2
Find = 4
Replace = 3
Find = 5
Replace = 4
Find = 6
Replace = 5
Find = 7
Replace = 6
Find = 8
Replace = 7
Find = 0
Replace = 8
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 04-18-2011, 02:47 AM
Griff's Avatar
Griff Griff is offline Find & Replace formula for numbers? Mac OS X Find & Replace formula for numbers? Microsoft Office 2008 for Mac
Novice
Find & Replace formula for numbers?
 
Join Date: Apr 2011
Posts: 3
Griff is on a distinguished road
Default

Oh bummer...

Oh, but that new solution looks like a perfect method. I hadn't even thought of "temporarily" changing one of the numbers to something else (0). That's great! Thank you!
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Find & Replace formula for numbers? Help with find and replace or query and replace shabbaranks Excel 4 03-19-2011 08:38 AM
Find and replace page numbers in body of text tollanarama Word 3 02-13-2011 06:00 AM
Find & Replace formula for numbers? replace automatically generated page numbers LitWissOnline Word 3 01-24-2011 03:40 PM
find and replace anil3b2 Word 0 08-03-2010 11:30 PM
Find /Replace Help ilcaa Word 2 11-02-2009 08:41 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:28 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft