+ Reply to Thread
Results 1 to 3 of 3

Using search with if function

Hybrid View

  1. #1
    Registered User
    Join Date
    03-24-2017
    Location
    nc
    MS-Off Ver
    2010
    Posts
    1

    Using search with if function

    I need help to create a formula that will search if cell B contains the same text as in cell A. If it does, I want it to delete just the text in cell B that is the same as Cell A. Here's an example:

    Cell A = PO Box 1252
    Cell B = PO Box 1252, Des Moines, IA


    Then Cell B should be updated to just "Des Moines, IA" and PO Box 1252 should be deleted from the cell.

    TIA

  2. #2
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2503
    Posts
    13,702

    Re: Using search with if function

    Hi rnrmom11. Welcome to the forum.

    Try
    Formula: copy to clipboard
    =SUBSTITUTE(SUBSTITUTE(B1,A1,""),", ","",1)



    A
    B
    C
    1
    PO Box 1252
    PO Box 1252, Des Moines, IA
    Des Moines, IA
    Dave

  3. #3
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Using search with if function

    Based on Dave's table, in C1: =IF(IFERROR(SEARCH(A1,B1)>0,0),SUBSTITUTE(B1,A1&", ",""),B1)
    change last B1 to "" if you want leave C1 blank while this condition IFERROR(SEARCH(A1,B1)>0,0) is FALSE

    edit:
    btw. formula cannot delete anything
    Last edited by sandy666; 03-24-2017 at 07:47 PM.

+ 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. If function + Find Function to search for multiple values
    By HabsFan89 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-21-2015, 12:11 PM
  2. [SOLVED] Set VBA search function to only search one row and also not show duplicates?
    By TomToms in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-05-2014, 04:00 PM
  3. Using Indirect function inside the Search function
    By skhari in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-20-2014, 05:32 PM
  4. How to search 2 criteria using this search function?
    By puuts in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-16-2014, 04:25 PM
  5. IF(count(search) Function not working when search from text from a cell
    By joshnathan in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 10-09-2013, 05:13 AM
  6. [SOLVED] Search function to search if worksheet contains specified text
    By mougiasm in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-07-2013, 02:50 PM
  7. Replies: 1
    Last Post: 10-18-2012, 05:52 AM

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