+ Reply to Thread
Results 1 to 10 of 10

Macro to extract certain numbers following strings (sample attached)

  1. #1
    Registered User
    Join Date
    02-24-2017
    Location
    Chicago
    MS-Off Ver
    2013
    Posts
    65

    Macro to extract certain numbers following strings (sample attached)

    Hi all,

    I need some help with a macro that can identify the numbers following a string and export it to corresponding columns.

    There are some catches, though, that make it more complicated.
    It is hard to explain all the niches with words, so i've created and attached a sample doc for what I'm looking for.


    Any and all help is appreciated!
    Thanks!
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,596

    Re: Macro to extract certain numbers following strings (sample attached)

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    02-24-2017
    Location
    Chicago
    MS-Off Ver
    2013
    Posts
    65

    Re: Macro to extract certain numbers following strings (sample attached)

    Forgive me for asking, but this all looks like gibberish to me haha.

    How do I specify things like "Amazon" and "Google" in the macro?

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,596

    Re: Macro to extract certain numbers following strings (sample attached)

    Have tried the code?

  5. #5
    Registered User
    Join Date
    02-24-2017
    Location
    Chicago
    MS-Off Ver
    2013
    Posts
    65

    Re: Macro to extract certain numbers following strings (sample attached)

    @jindon

    My "Google" values weren't showing up, but I figured out what was going wrong, in the text the string "Google :" was written instead of "Google: ".

    There's just one other thing though----decimals are being truncated when the macro is run.
    e.g. Amazon "5.444" is cut down to "5"

    How do I change it to make all decimal points show up?

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,596

    Re: Macro to extract certain numbers following strings (sample attached)

    OOps, sorry, I didn't notice that...
    Change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    02-24-2017
    Location
    Chicago
    MS-Off Ver
    2013
    Posts
    65

    Re: Macro to extract certain numbers following strings (sample attached)

    Hmm, that didn't seem to solve the issue.

    I also checked the cell formatting to make sure the decimals weren't just being hidden--they're showing up as __.00000

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,596

    Re: Macro to extract certain numbers following strings (sample attached)

    That one,too...
    Please Login or Register  to view this content.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    02-24-2017
    Location
    Chicago
    MS-Off Ver
    2013
    Posts
    65

    Re: Macro to extract certain numbers following strings (sample attached)

    @jindon

    This sub works great, though I should have mentioned that sometimes I will have negative values, under say, Amazon.

    This macro doesn't seem to pick those up. How can I modify it to get those?

    Thanks!

  10. #10
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,596

    Re: Macro to extract certain numbers following strings (sample attached)

    Change .Pattern to
    Please Login or Register  to view this content.

+ 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. Vba macro to extract (numbers & strings) from cell -Regex
    By zeekad in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-11-2014, 04:33 AM
  2. Looking for way to extract certain sample numbers
    By barspurk in forum Excel General
    Replies: 4
    Last Post: 12-06-2013, 04:40 PM
  3. [SOLVED] Extract Numbers from Cells containing alphanumeric strings; and sum all figures
    By elliotencore in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-01-2013, 02:52 PM
  4. Help writing macro for +1 and -1 Columns (sample file attached)
    By smitha6 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 11-20-2012, 03:10 PM
  5. extract numbers out of strings.
    By mikeburg in forum Excel General
    Replies: 3
    Last Post: 08-06-2008, 04:52 PM
  6. Replies: 13
    Last Post: 03-23-2006, 11:55 AM
  7. Extract numbers from strings
    By Stan Altshuller in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-18-2005, 10: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