+ Reply to Thread
Results 1 to 12 of 12

excel function on how to retrive piece of text from range of cells

  1. #1
    Registered User
    Join Date
    04-26-2013
    Location
    Delhi
    MS-Off Ver
    Excel 2003
    Posts
    16

    excel function on how to retrive piece of text from range of cells

    Hi,

    I have some range of data in column A like

    text_CPC_text
    text_shopping_text
    text_CPL_text

    I want to extract CPC in column B wherever it is mentioned in columnn A
    and i want to extract shopping in column B wherever it is mentioned in columnA.

    I am trying IF(A:A="CPC","CPC", IF(A:A="shopping",Shopping")) but it is not working.

    Please help me with correct function.

    Regards,
    Rohit

  2. #2
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,577

    Re: excel function on how to retrive piece of text from range of cells

    Try this

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: excel function on how to retrive piece of text from range of cells

    Try this formula

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  4. #4
    Registered User
    Join Date
    04-26-2013
    Location
    Delhi
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: excel function on how to retrive piece of text from range of cells

    Quote Originally Posted by kvsrinivasamurthy View Post
    Try this

    Please Login or Register  to view this content.
    Hi Srinivasamurthy,

    Thankyou for your response, but it is not working, kindly suggest some other code

  5. #5
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: excel function on how to retrive piece of text from range of cells

    Did you try the formula i provided you?

  6. #6
    Registered User
    Join Date
    04-26-2013
    Location
    Delhi
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: excel function on how to retrive piece of text from range of cells

    Yes Arul,

    I have tried your formula but it shows error msg box.

  7. #7
    Registered User
    Join Date
    04-26-2013
    Location
    Delhi
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: excel function on how to retrive piece of text from range of cells

    I have tried using =if(search("CPL",A1)=1,"CPL", if(search("shopping",A1)=1,"Shopping")"")

    but it again shows error in msg box, may be i am not writing function correctly.

    Please suggest how to use multiple search function.

  8. #8
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211

    Re: excel function on how to retrive piece of text from range of cells

    Quote Originally Posted by Rohit2500 View Post
    I have tried using =if(search("CPL",A1)=1,"CPL", if(search("shopping",A1)=1,"Shopping")"")

    but it again shows error in msg box, may be i am not writing function correctly.

    Please suggest how to use multiple search function.
    Try it like this:

    =LOOKUP("zzz",CHOOSE({1,2},"",LOOKUP(1E99,SEARCH({"CPL","shopping"},A1),{"CPL","shopping"})))

  9. #9
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    2,366

    Re: excel function on how to retrive piece of text from range of cells

    =SUBSTITUTE(SUBSTITUTE(A1;LEFT(A1;FIND("_";A1;1));"");RIGHT(SUBSTITUTE(A1;LEFT(A1;FIND("_";A1;1));"");FIND("_";A1;1));"")

    It Work bro, what MS Excel Version do you use?

    Put your data in A1 first bro --> text_CPC_text

  10. #10
    Registered User
    Join Date
    04-26-2013
    Location
    Delhi
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: excel function on how to retrive piece of text from range of cells

    Hi Azumi,

    It is showing error even if i put data in A1.

  11. #11
    Registered User
    Join Date
    04-26-2013
    Location
    Delhi
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: excel function on how to retrive piece of text from range of cells

    Hi Teethless mama,

    Your code is working a bit but i didnt unde it is showing zero result (without any error), also pls tell me have u taken "zzz" and lookup(1E99

  12. #12
    Registered User
    Join Date
    04-26-2013
    Location
    Delhi
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: excel function on how to retrive piece of text from range of cells

    Friends,

    I have tried this code and finally its working. You can refer below code if required.

    =IF(SUM(COUNTIF(A2,{"*CPL*"}))>0,"CPL",IF(SUM(COUNTIF(A2,{"*shopping*"}))>0,"SHOP","CPM"))

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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