+ Reply to Thread
Results 1 to 19 of 19

subtrac string values from a text and create three extra column with the info extracted

  1. #1
    Registered User
    Join Date
    10-16-2012
    Location
    London, England
    MS-Off Ver
    Excel 2013
    Posts
    44

    subtrac string values from a text and create three extra column with the info extracted

    Hi,

    I have a column with the following format (this is a short example):

    Can Al SOL 355ml Exp 2014
    Can Al 7UP 330ml STD Vintage 50s 2015
    ZZ_Can Al HEINEKEN Light 500ml 473 US 13
    ZZ_Can Al TECATE 710ml MX 2009
    Can Al SOL 355ml Carnaval 2012
    Can Al HEINEKEN 330ml 4x6 NL 1508
    ZZ_Can Al CARTA BLANCA Light 355ml 2010
    Can Al CARTA BLANCA 355ml CL/CO 2012
    Can Al STRONGBOW Red Berries 400BG/GR/RO


    I need to create three extra columns with: Brand, capacity and description

    Brand Capacity Description
    SOL 355ml Exp 2014
    7UP 330ml STD Vintage 50s 2015
    HEINEKEN Light 500ml 473 US 13
    TECATE 710ml MX 2009
    SOL 355ml Carnaval 2012
    HEINEKEN 330ml 4x6 NL 1508
    CARTA BLANCA Light 355ml 2010
    CARTA BLANCA 355ml CL/CO 2012
    STRONGBOW Red Berries 400BG/GR/RO

    I was wondering if it is possible to use a formula(s) to subtract/extract the information/values needed.

    Please see attached file which illustrates what I need.

    example.xlsx

    Please, let me know if you need anything else!

    Thanks in advance!

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,646

    Re: subtrac string values from a text and create three extra column with the info extracte

    B2:

    =TRIM(MID($A2,SEARCH("Can Al",$A2)+6,IFERROR(SEARCH("ml",$A2),SEARCH("BG/",$A2))-SEARCH("Can Al",$A2)-9))

    C2:

    =IFERROR(TRIM(RIGHT(LEFT($A2,SEARCH("ml",$A2)-1),4)),"")

    D2:

    =TRIM(MID($A2,IFERROR(SEARCH("ml",$A2),SEARCH("BG/",$A2)-6)+2,255))
    Quang PT

  3. #3
    Registered User
    Join Date
    10-16-2012
    Location
    London, England
    MS-Off Ver
    Excel 2013
    Posts
    44

    Re: subtrac string values from a text and create three extra column with the info extracte

    Hi Quang PT,

    thanks for your code, it does work perfectly!!!!;-)

    I just realize that I also need the type. Some beers are: light, free, gold, etc.

    I have attached the file again to illustrate what I mean.

    Thanks a lot for your help!

    example.xlsx

  4. #4
    Registered User
    Join Date
    10-16-2012
    Location
    London, England
    MS-Off Ver
    Excel 2013
    Posts
    44

    Re: subtrac string values from a text and create three extra column with the info extracte

    Hi, does anyone know a function to identify uppercase words?

    In my example the brands are always uppercase.

  5. #5
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,646

    Re: subtrac string values from a text and create three extra column with the info extracte

    I am getting closer, but type is not identified. Do you have a complete list of types?
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor mangesh.mehendale's Avatar
    Join Date
    06-04-2015
    Location
    India
    MS-Off Ver
    2007
    Posts
    510

    Re: subtrac string values from a text and create three extra column with the info extracte

    Done... For Brand name... other things are already tackle by Sir bebo021999..

    [/formula]
    =IF(EXACT(UPPER(SUBSTITUTE(LEFT(A16,FIND(CHAR(1),SUBSTITUTE(A16," ",CHAR(1),4))),LEFT(A16,FIND(CHAR(1),SUBSTITUTE(A16," ",CHAR(1),2))),"")),SUBSTITUTE(LEFT(A16,FIND(CHAR(1),SUBSTITUTE(A16," ",CHAR(1),4))),LEFT(A16,FIND(CHAR(1),SUBSTITUTE(A16," ",CHAR(1),2))),"")),SUBSTITUTE(LEFT(A16,FIND(CHAR(1),SUBSTITUTE(A16," ",CHAR(1),4))),LEFT(A16,FIND(CHAR(1),SUBSTITUTE(A16," ",CHAR(1),2))),""),SUBSTITUTE(LEFT(A16,FIND(CHAR(1),SUBSTITUTE(A16," ",CHAR(1),3))),LEFT(A16,FIND(CHAR(1),SUBSTITUTE(A16," ",CHAR(1),2))),""))
    [/formula]
    Attached Files Attached Files
    Last edited by mangesh.mehendale; 10-23-2015 at 03:45 AM.
    Don`t care, take care...

    Regards,
    Mangesh

  7. #7
    Registered User
    Join Date
    10-16-2012
    Location
    London, England
    MS-Off Ver
    Excel 2013
    Posts
    44

    Re: subtrac string values from a text and create three extra column with the info extracte

    Thanks for your response! I'm getting there!

    I have now a list of brands, types and capacities. I would like to double check that I'm getting everything.

    I would like to create a vlookup. This should look at column Product description and check if the brand (from my list) exists, if so paste the brand next to it:

    ProductDescription BrandCheck
    SOL 355ml Exp 2014 SOL
    NekeiehKENIEH Light 500ml FALSE
    HEINEKEN Light 500ml HEINEKEN

    This way I can identify which brands I'm missing.

    Thanks for your help

    Book2.xlsx

  8. #8
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: subtrac string values from a text and create three extra column with the info extracte

    I doubt very much if your list of examples is truly representative... but this works for the examples given...

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


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


    Description
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  9. #9
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,646

    Re: subtrac string values from a text and create three extra column with the info extracte

    @Glen
    I afraid that your solution does not meet his latest requirement in #3

  10. #10
    Registered User
    Join Date
    08-04-2015
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    82

    Re: subtrac string values from a text and create three extra column with the info extracte

    You can add reputation(s) of those who helped

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: subtrac string values from a text and create three extra column with the info extracte

    Bebo... Damn and blast!!! I missed that bit.

  12. #12
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,939

    Re: subtrac string values from a text and create three extra column with the info extracte

    B2=TRIM(MID(SUBSTITUTE(A2," ",REPT(" ",LEN(A2))),1+2*LEN(A2),AND(ABS(109.5-CODE(LEFT(TRIM(MID(SUBSTITUTE(A2," ",REPT(" ",LEN(A2))),1+3*LEN(A2),LEN(A2))),1)))>12.5,ABS(109.5-CODE(RIGHT(TRIM(MID(SUBSTITUTE(A2," ",REPT(" ",LEN(A2))),1+3*LEN(A2),LEN(A2))),1)))>12.5)*LEN(A2)+LEN(A2)))
    Please Login or Register  to view this content.
    D2=IFERROR(TRIM(RIGHT(SUBSTITUTE(REPLACE(A2,SEARCH("ml",A2)+2,256,)," ",REPT(" ",50)),50)),"")
    Please Login or Register  to view this content.
    E2=IFERROR(TRIM(IF(D2="",RIGHT(SUBSTITUTE(A2," ",REPT(" ",50)),50),REPLACE(A2,1,SEARCH("ml",A2)+2,))),"")
    Please Login or Register  to view this content.
    C2=TRIM(SUBSTITUTE(SUBSTITUTE(REPLACE(A2,1,SEARCH(B2,A2)+LEN(B2),),D2,""),E2,""))
    Please Login or Register  to view this content.
    I hope some one come with better formula, I am eagerly waiting for that
    see the attached file
    Attached Files Attached Files
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  13. #13
    Registered User
    Join Date
    10-16-2012
    Location
    London, England
    MS-Off Ver
    Excel 2013
    Posts
    44

    Re: subtrac string values from a text and create three extra column with the info extracte

    Wow, that is a great solution!!!!

    Thanks to all of you!!!

  14. #14
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,646

    Re: subtrac string values from a text and create three extra column with the info extracte

    Nice to hear it works with nfsales. Beside formula in B2 appears complicated, it does not work with brand name with 3 groups of upper charaters
    like this:
    solve: ZZ_Can Al CARTA BLANCA Light 355ml 2010
    not solve: ZZ_Can Al CARTA BLANCA ABC Light 355ml 2010

  15. #15
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,939

    Re: subtrac string values from a text and create three extra column with the info extracte

    Quote Originally Posted by bebo021999 View Post
    Nice to hear it works with nfsales. Beside formula in B2 appears complicated, it does not work with brand name with 3 groups of upper charaters
    like this:
    solve: ZZ_Can Al CARTA BLANCA Light 355ml 2010
    not solve: ZZ_Can Al CARTA BLANCA ABC Light 355ml 2010
    it this case use below formula
    =TRIM(MID(SUBSTITUTE(A2," ",REPT(" ",LEN(A2))),2*LEN(A2)+1,MIN(FIND({"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","v","w","x","y","z"},SUBSTITUTE(A2," ",REPT(" ",LEN(A2)))&"abcdefghijklmnopqrstuvwxyz",2*LEN(A2)+1))-3*LEN(A2)))
    Please Login or Register  to view this content.

  16. #16
    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: subtrac string values from a text and create three extra column with the info extracte

    I tried another approach ... backwards one solving Capacity (D2:D10) first, then Description (E2:E10). Then went to B2:B10 and C2:C10. Untidy approach but it seems easier and allowed for shorter formulas than I was previously getting.

    In D2 and down this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    In E2 and down this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    In B2 and down this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and in E2 and down this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    File is attached.
    Dave

  17. #17
    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: subtrac string values from a text and create three extra column with the info extracte

    Double posted.

  18. #18
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,939

    Re: subtrac string values from a text and create three extra column with the info extracte

    Quote Originally Posted by FlameRetired View Post
    I tried another approach ... backwards one solving Capacity (D2:D10) first, then Description (E2:E10). Then went to B2:B10 and C2:C10. Untidy approach but it seems easier and allowed for shorter formulas than I was previously getting.

    In D2 and down this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    In E2 and down this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    In B2 and down this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and in E2 and down this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    File is attached.
    Instead of =IFERROR(MID($A2,LOOKUP(25^25,FIND(ROW($100:$999)&"ml ",$A2)),5),"") can use
    =IFERROR(MID($A2,LOOKUP(25^25,FIND(ROW($1:$9)&"??ml ",$A2)),5),"")

  19. #19
    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: subtrac string values from a text and create three extra column with the info extracte

    Quote Originally Posted by nflsales View Post
    Instead of =IFERROR(MID($A2,LOOKUP(25^25,FIND(ROW($100:$999)&"ml ",$A2)),5),"") can use
    =IFERROR(MID($A2,LOOKUP(25^25,FIND(ROW($1:$9)&"??ml ",$A2)),5),"")
    Yes. Better. Thanks for the backup.

    Edit @nflsales: FIND needs to be replaced w/ SEARCH. FIND won't allow wildcard characters.
    Last edited by FlameRetired; 10-26-2015 at 03:53 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. Taking a string of text and adding extra chars, for a column.
    By X82 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-05-2015, 02:35 PM
  2. Create VBA that types text into a column if target cell contains certain string
    By ppilot in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-22-2014, 04:22 PM
  3. [SOLVED] SUMIF Query: How to summarise values based on data extracted from a text string
    By The_Snook in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 07-17-2013, 10:12 AM
  4. [SOLVED] Time values from extracted text strings
    By Steve Roth in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-08-2012, 01:39 PM
  5. Replies: 7
    Last Post: 08-25-2012, 12:53 PM
  6. [SOLVED] getting Excel to create an extra column
    By Vass in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-17-2006, 07:50 AM
  7. Replies: 1
    Last Post: 04-01-2005, 01:06 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