+ Reply to Thread
Results 1 to 8 of 8

Find and Replace wildcard

  1. #1
    Registered User
    Join Date
    01-12-2019
    Location
    New York
    MS-Off Ver
    1811 (office 365)
    Posts
    21

    Find and Replace wildcard

    Hello,

    Are there any wild characters i can put to replace only the first two digits of the following string 02-7602-02.

    i.e replace 02-7602-02 with 01-7602-02.

    unfortunately, when I enter 02 in the FIND field and 01 in the REPLACE field, it also changes all other "02" in the string with 01.

    Thanks

  2. #2
    Forum Contributor
    Join Date
    03-18-2014
    Location
    Singapore
    MS-Off Ver
    Excel 2016 / 2019
    Posts
    251

    Re: Find and Replace wildcard

    put 02-7602-02 to A2
    B2
    =IF(LEFT(A2,2)="02", REPLACE(A2,1, SEARCH("02",A2)+1, "01"))

    there may be other pattern so best to upload a sample data
    Christopher Yap

  3. #3
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,935

    Re: Find and Replace wildcard

    or can use

    =SUBSTITUTE(A2,"02","01",1)
    If I helped, Don't forget to add reputation (click on the little star ★ at bottom of this post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)

  4. #4
    Registered User
    Join Date
    01-12-2019
    Location
    New York
    MS-Off Ver
    1811 (office 365)
    Posts
    21

    Re: Find and Replace wildcard

    Quote Originally Posted by shukla.ankur281190 View Post
    or can use

    =SUBSTITUTE(A2,"02","01",1)
    this seems to work better however it also changes the last two digits as well. I'm only interested in the first two digits regardless what numbers are after

    Incorrect
    01-7830-02 to 01-7830-01


    Correct 02-7802-02 to 01-7802-02

  5. #5
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,935

    Re: Find and Replace wildcard

    No it is working perfectly fine to me

    Check the file
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    01-12-2019
    Location
    New York
    MS-Off Ver
    1811 (office 365)
    Posts
    21

    Re: Find and Replace wildcard

    Quote Originally Posted by shukla.ankur281190 View Post
    No it is working perfectly fine to me

    Check the file
    Its not working for me not sure if im doing something wrong
    Attached Files Attached Files

  7. #7
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,935

    Re: Find and Replace wildcard

    Try

    C2=IF(LEFT(TRIM(B2),2)="02",TRIM(SUBSTITUTE(B2,"02","01",1)),TRIM(B2))

  8. #8
    Registered User
    Join Date
    01-12-2019
    Location
    New York
    MS-Off Ver
    1811 (office 365)
    Posts
    21

    Re: Find and Replace wildcard

    Quote Originally Posted by shukla.ankur281190 View Post
    Try

    C2=IF(LEFT(TRIM(B2),2)="02",TRIM(SUBSTITUTE(B2,"02","01",1)),TRIM(B2))
    you my friend.... saved me a ton of work i appreciate you taking the time to solve this. excellent job

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] How to Find and Replace Function Using Wildcard or Formula
    By garrett.grillo in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-02-2014, 02:17 AM
  2. [SOLVED] Find: Using wildcard, but don't replace with wildcard
    By JimDandy in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-06-2013, 05:39 PM
  3. [SOLVED] Find and replace words with a wildcard
    By boomboomblock in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-04-2013, 09:58 AM
  4. [SOLVED] VBA needed to find and replace text using a wildcard
    By jgupte in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-30-2012, 08:10 PM
  5. Wildcard Find and Replace
    By DaveSmith2020 in forum Excel General
    Replies: 5
    Last Post: 02-16-2009, 12:27 PM
  6. Replies: 8
    Last Post: 08-17-2005, 09:05 PM
  7. Preserving wildcard in Find and Replace
    By rdobson in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 05-12-2005, 09:14 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1