+ Reply to Thread
Results 1 to 6 of 6

Extracting Text after a character - but ignoring if character is blank

  1. #1
    Registered User
    Join Date
    05-16-2019
    Location
    London, England
    MS-Off Ver
    2016
    Posts
    54

    Extracting Text after a character - but ignoring if character is blank

    Hi All

    I'm trying to make an Excel file more consistent with it's data and in particular I have the following Issue.

    COLUMN A - COLUMN B
    Germany (DE) - DE
    Great Britain (GBR) GBR
    United States (USA) - Romania (ROM)


    For Column A I have done the following - =RIGHT(AL2,LEN(AL2)-SEARCH("(",AL2)) - It now only shows the data after the Brackets - WORKING.
    Column B though, If I use the same formula, on rows where there are no brackets it states #VALUES

    But the issue is, in this Column, if there's no Brackets I want to leave it alone and show the data (in this example, if there's no brackets, then it definitely has the short code), whilst for values where there are Brackets, I want it just follow the originally formula.

    Hope this makes sense - I tried to put it into a table but the option is greyed out.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,595

    Re: Extracting Text after a character - but ignoring if character is blank

    Please attach a sample workbook - instructions at the top of the page.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Expert Roel Jongman's Avatar
    Join Date
    03-28-2015
    Location
    Netherlands
    MS-Off Ver
    Office 365
    Posts
    1,483

    Re: Extracting Text after a character - but ignoring if character is blank

    I think you can solve this with an IFERROR() function

    My Guess without example file would be:

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    05-16-2019
    Location
    London, England
    MS-Off Ver
    2016
    Posts
    54

    Re: Extracting Text after a character - but ignoring if character is blank

    Absolute legend! That works a treat!

    One drawback in my file is that it doesn't include the Opening Brackets in the output cell, so I'm just using CONCATENATE to put it in.

    Another thing I could do is remove the end Brackets and would I be on the right lines to nest a LEN formula that gets rid of one character from the right?

    (I tried to add the document but it's not working in Chrome nor Edge)

  5. #5
    Registered User
    Join Date
    06-04-2018
    Location
    Europe
    MS-Off Ver
    Office365
    Posts
    78

    Re: Extracting Text after a character - but ignoring if character is blank

    One drawback in my file is that it doesn't include the Opening Brackets in the output cell, so I'm just using CONCATENATE to put it in.
    Use this: =IFERROR(RIGHT(A2,LEN(A2)-SEARCH("(",A2)+1),"") you will get (DE) or (GBR)

    Another thing I could do is remove the end Brackets and would I be on the right lines to nest a LEN formula that gets rid of one character from the right?
    To get only DE or GBR use this formula: =IFERROR(SUBSTITUTE(MID(A2,FIND("(",A2)+1,LEN(A2)),")",""),"")

  6. #6
    Registered User
    Join Date
    05-16-2019
    Location
    London, England
    MS-Off Ver
    2016
    Posts
    54

    Re: Extracting Text after a character - but ignoring if character is blank

    Thank you

+ 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] Extracting text upto specific character from a different cell.
    By mowens74 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-21-2018, 04:37 AM
  2. [SOLVED] User-form, selecting text character by character
    By Un-Do Re-Do in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-18-2017, 11:21 AM
  3. Remove blank character and change the character (or symbol)
    By vutienhp in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-02-2015, 11:55 PM
  4. [SOLVED] Remove first character in a cell when the second character is blank
    By eastdallasguy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-01-2013, 03:11 PM
  5. Replies: 3
    Last Post: 11-08-2012, 05:01 PM
  6. Macro to find character and delete all text in cell after the character
    By SpencerRichman in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-01-2012, 06:08 PM
  7. [SOLVED] importing undelimited text file data, character-by-character
    By The Mos$ in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-26-2005, 07:10 AM

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