Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-31-2021, 11:57 AM
ranjan ranjan is offline Removing a duplicate words Windows 10 Removing a duplicate words Office 2019
Advanced Beginner
Removing a duplicate words
 
Join Date: May 2021
Posts: 36
ranjan is on a distinguished road
Default Removing a duplicate words

hi,



i need a macro for removing a immediate duplicate words in a documents.

example :

Input: Title: Title: please use a meaningful and specific title to describe your question.
Output: Title: please use a meaningful and specific title to describe your question.

In the above case green colored "title" is removed only if there is following or immediate same words.
If there is no same word it remains constant as seen in red colored word "title" and it has not to be changed in anywhere.
like title word is presented three times in a doc but only removed only at one place.

please do the needful ...
Reply With Quote
  #2  
Old 05-31-2021, 03:11 PM
macropod's Avatar
macropod macropod is offline Removing a duplicate words Windows 10 Removing a duplicate words Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,212
macropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant future
Default

You don't need a macro for this. It can all be done via a wildcard Find/Replace.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 05-31-2021, 08:23 PM
ranjan ranjan is offline Removing a duplicate words Windows 10 Removing a duplicate words Office 2019
Advanced Beginner
Removing a duplicate words
 
Join Date: May 2021
Posts: 36
ranjan is on a distinguished road
Default

hi
thanks for replying..
but in a document am having more than 100 strings and manually checking and replacing will take more time, if it is possible through single click it will be more helpful to me.
Reply With Quote
  #4  
Old 06-01-2021, 02:01 PM
macropod's Avatar
macropod macropod is offline Removing a duplicate words Windows 10 Removing a duplicate words Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,212
macropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant future
Default

A single wildcard Find/Replace can clean up all duplicated words (as well as duplicated multi-word strings) in a document. For example:
Find = (<*>?@)\1
Replace = \1
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 07-19-2021, 11:15 PM
ranjan ranjan is offline Removing a duplicate words Windows 10 Removing a duplicate words Office 2019
Advanced Beginner
Removing a duplicate words
 
Join Date: May 2021
Posts: 36
ranjan is on a distinguished road
Default

Hi,

Its working great but when the repeated text was at the end of the line, it was not get replaced, can you please modify the find & replace text, it will be more helpful to me.

Ex:

Input: financial income income
Output: financial income
Input: unit: INR
Output: unit: INR
Input : gain from sales
Output : gain from sales
Input : income From gain gain
Output : income From gain
Reply With Quote
  #6  
Old 08-25-2021, 02:07 PM
ranjan ranjan is offline Removing a duplicate words Windows 10 Removing a duplicate words Office 2019
Advanced Beginner
Removing a duplicate words
 
Join Date: May 2021
Posts: 36
ranjan is on a distinguished road
Default

Hi,

Could you please review the above one, is there any change in the FIND String to get replace with this conditions...

Input: financial income income
Input: interest income
Input : gain from sales
Input : income income From gain gain

Output: financial income
Output: interest income
Output: gain from sales
Output: income From gain

Only starting line items were get replaced, if there is any same double line items at the end it will not get replaced.

Find = (<*>?@)\1
Replace = \1

With the above command only highlighted bold one get replaced even though we are having repeated words at the end of the line.

Please check and do the needful...
Reply With Quote
  #7  
Old 08-25-2021, 11:32 PM
Guessed's Avatar
Guessed Guessed is offline Removing a duplicate words Windows 10 Removing a duplicate words Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 2,554
Guessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to behold
Default

What happens if you change the find what to search for
(<*>) \1

Note there is a space in front of the \1
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #8  
Old 08-26-2021, 02:17 AM
ranjan ranjan is offline Removing a duplicate words Windows 10 Removing a duplicate words Office 2019
Advanced Beginner
Removing a duplicate words
 
Join Date: May 2021
Posts: 36
ranjan is on a distinguished road
Default

Thank you for your response to my quiery. I appreciate the information you have provided me with, and I appreciate your prompt reply.
Reply With Quote
Reply

Tags
removing duplicates

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Removing a duplicate words Removing duplicate cross-reference entries in an index Rajesoz Word 4 05-18-2018 03:48 PM
Removing duplicate rows when identical value in a column ballpoint Excel 1 01-05-2018 08:54 AM
Removing a duplicate words Removing Duplicate Text in a Document rsrasc Word VBA 11 10-26-2014 02:02 PM
Locating and removing large, duplicate blocks of copy in word markaffleck Word 2 06-05-2014 10:12 PM
Removing duplicate index entries Bengt Word 5 03-01-2013 02:01 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:30 AM.


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