+ Reply to Thread
Results 1 to 9 of 9

Search & extract cell data, after & before specific values with a formula

  1. #1
    Registered User
    Join Date
    07-28-2013
    Location
    Athens
    MS-Off Ver
    Excel 2010
    Posts
    55

    Question Search & extract cell data, after & before specific values with a formula

    I need a formula to extract data after "<li>Color: " & before"</li>"

    A
    B
    1
    ORIGINAL
    RESULTS
    2
    blah blah blah<li>Color: White</li>some informations White
    3
    blah blah blah<li>Color: Red</li>some informations Red
    4
    blah blah blah<li>Color: Black</li>some informations Black
    5
    blah blah blah<li>Color: Red</li>some informations Red


    I Have already use this formula but I get the "#VALUE!" error even if the cell contains the "<li>Color: </li>" data.
    Please Login or Register  to view this content.
    Please help me with a working formula.

    PS!!!
    Sometimes, some cells does not contain the "<li>Color: </li>" data, I don't want the "#VALUE!" error, I just want a blank cell there.

    Thanks.

    UPDATE!!!
    This is an example with the real values I want to extract
    Example.xlsx

    ___________________________UPDATE___________

    This is the formula that works (thanks to hemesh):
    Please Login or Register  to view this content.
    Last edited by lagiosman; 05-20-2014 at 09:03 AM.
    ~Our technology has exceeded our humanity~

  2. #2
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Search & extract cell data, after & before specific values with a formula

    try below in c2
    =IFERROR(TRIM(MID(SUBSTITUTE(B2,"<",REPT(" ",100),2),LOOKUP(10^10,SEARCH(":",B2))+2,100)),"")

    drag down
    Last edited by hemesh; 05-20-2014 at 06:52 AM.
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    WANT TO SAY THANKS, HIT ADD REPUTATION (*) AT THE BOTTOM LEFT CORNER OF THE POST

    More we learn about excel, more it shows us, how less we know about it.

    for chemistry
    https://www.youtube.com/c/chemistrybyshivaansh

  3. #3
    Registered User
    Join Date
    07-28-2013
    Location
    Athens
    MS-Off Ver
    Excel 2010
    Posts
    55

    Re: Search & extract cell data, after & before specific values with a formula

    Quote Originally Posted by hemesh View Post
    try below in c2
    =IFERROR(TRIM(MID(SUBSTITUTE(B2,"<",REPT(" ",100),2),LOOKUP(10^10,SEARCH(":",B2))+2,100)),"")

    drag down
    This formula gives me the entire data of a cell, even if the cell does not contain the "<li>Color: </li>" data

    eg:
    A B
    1 ORIGINAL RESULTS
    2 blah blah blah<li>Color: White</li>some informations blah blah blah<li>Color: White</li>some informations

    So this formula does not work at all.


    This is what I want:
    A
    B
    1
    ORIGINAL
    RESULTS
    2
    blah blah blah<li>Color: White</li>some informations White
    3
    blah blah blah<li>Color: Red</li>some informations Red
    4
    blah blah blah<li>Color: Black</li>some informations Black
    5
    blah blah blah<li>Color: Red</li>some informations Red


    Please help me with a working formula.
    Last edited by lagiosman; 05-20-2014 at 07:13 AM.

  4. #4
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Search & extract cell data, after & before specific values with a formula

    I copied your data without deleting row numbers just change the references
    A2 is the cell where your data is
    =IFERROR(TRIM(MID(SUBSTITUTE(A2,"<",REPT(" ",100),2),LOOKUP(10^10,SEARCH(":",A2))+2,100)),"")
    Attached Files Attached Files
    Last edited by hemesh; 05-20-2014 at 07:23 AM.

  5. #5
    Forum Expert
    Join Date
    03-28-2014
    Location
    Hyderabad,India
    MS-Off Ver
    Excel 2013
    Posts
    1,887

    Re: Search & extract cell data, after & before specific values with a formula

    Hi,

    try This formula once =MID(A1,(FIND(":",A1)+1),(FIND("<",A1,16)-(FIND(":",A1))-1))

    Punnam

  6. #6
    Registered User
    Join Date
    07-28-2013
    Location
    Athens
    MS-Off Ver
    Excel 2010
    Posts
    55

    Re: Search & extract cell data, after & before specific values with a formula

    Quote Originally Posted by hemesh View Post
    I copied your data without deleting row numbers just change the references
    A2 is the cell where your data is
    =IFERROR(TRIM(MID(SUBSTITUTE(A2,"<",REPT(" ",100),2),LOOKUP(10^10,SEARCH(":",A2))+2,100)),"")
    Please take a look here:
    This is an example with the real values I want to extract
    Attachment 319480

  7. #7
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Search & extract cell data, after & before specific values with a formula

    try below in B2
    =IFERROR(TRIM(MID(A2,FIND(">Color:",A2)+7,FIND("<",A2,FIND(">Color:",A2))-FIND(">Color:",A2)-7)),"")

    find always does a case sensitive search if Color and be color than use search instead of find
    Last edited by hemesh; 05-20-2014 at 08:44 AM.

  8. #8
    Registered User
    Join Date
    07-28-2013
    Location
    Athens
    MS-Off Ver
    Excel 2010
    Posts
    55

    Re: Search & extract cell data, after & before specific values with a formula

    Quote Originally Posted by hemesh View Post
    try below in B2
    =IFERROR(TRIM(MID(A2,FIND(">Color:",A2)+7,FIND("<",A2,FIND(">Color:",A2))-FIND(">Color:",A2)-7)),"")

    find always does a case sensitive search if Color and be color than use search instead of find
    Thank you very much, its working.

  9. #9
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Search & extract cell data, after & before specific values with a formula

    Please see attached file.
    Attached Files Attached Files
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

+ 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] Excel formula or macro, search and extract data to another cell.
    By lagiosman in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 05-11-2014, 09:36 AM
  2. [SOLVED] Wanting to extract specific data from a table of values
    By lvsmr2 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 07-04-2013, 02:24 AM
  3. Replies: 3
    Last Post: 02-25-2013, 08:11 AM
  4. Formula to search a cell for specific data to extract
    By AK262007 in forum Excel General
    Replies: 4
    Last Post: 03-13-2009, 10:37 AM
  5. Loop thru lines of text in a cell and extract specific values: please help?
    By Mslady in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-03-2006, 10:22 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