+ Reply to Thread
Results 1 to 20 of 20

Extracting text from a string

  1. #1
    Registered User
    Join Date
    11-15-2021
    Location
    Gatineau, Canada
    MS-Off Ver
    O365
    Posts
    16

    Extracting text from a string

    Hi,

    Hope this is descript enough. I work in IT, I am running a report to identify license usage. We have 3 companies using these licenses on the server. The only way to identify a user from a company is their email address. I would like to extract the word between at and the first dot so JohnDoe at company 1 dot com JaneSmith at company 2 dot com Steve stevenson at company 3 dot com

    Email addresses are in Column I, the data will be moved to column J

    So then I'd have a column with

    Company 1
    Company 2
    Company 3

    There are about 5200 licenses and I don't want to type this out manually for each one lol.


    Thanks in advance.
    Last edited by H1ghway; 01-21-2022 at 11:14 AM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,884

    Re: Extracting text from a string

    Can be achieved quickly using Power Query/Get and Transform Data found on the Data Tab.

    Fast answers need visual help. Please read the yellow banner at the top of this page on how to attach a file.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Valued Forum Contributor
    Join Date
    11-02-2016
    Location
    NY
    MS-Off Ver
    2010
    Posts
    459

    Re: Extracting text from a string

    Make a Copy of your info (I usually put on another tab~this way you have a backup). Highlight your data, then Go to Data/ TextToColumns/ DELIMITED/ next / only check the OTHERBox and put in a period /Finish ~ this will pull out your info

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,445

    Re: Extracting text from a string

    Try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    Registered User
    Join Date
    11-15-2021
    Location
    Gatineau, Canada
    MS-Off Ver
    O365
    Posts
    16

    Re: Extracting text from a string

    Text to columns doesn't work because some emails are at company dot company dot ca. We live in Canada so the email for one company is english dot french dot ca.
    So the text to columns gets screwed up when you put it at the dot.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    11-15-2021
    Location
    Gatineau, Canada
    MS-Off Ver
    O365
    Posts
    16

    Re: Extracting text from a string

    Quote Originally Posted by TMS View Post
    Try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    I tried this, edited the formula to reflect the data in Column I and I received a value error. I tried on company with 2 company names after the at and another company with only 1 and I received the error on both.

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,445

    Re: Extracting text from a string

    Did you see post #4?

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,445

    Re: Extracting text from a string

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

  9. #9
    Registered User
    Join Date
    11-15-2021
    Location
    Gatineau, Canada
    MS-Off Ver
    O365
    Posts
    16

    Re: Extracting text from a string

    Quote Originally Posted by TMS View Post
    Try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    I realized my error in sharing the data. Majority of the email addresses are first dot last which i removed in trying to keep privacy. However, some emails are lastfir at company dot company dot com

  10. #10
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,884

    Re: Extracting text from a string

    A Power Query Solution

    Please Login or Register  to view this content.
    Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

    It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

    - Follow this link to learn how to install Power Query in Excel 2010 / 2013.

    - Follow this link for an introduction to Power Query functionality.

    - Follow this link for a video which demonstrates how to use Power Query code provided.

  11. #11
    Registered User
    Join Date
    11-15-2021
    Location
    Gatineau, Canada
    MS-Off Ver
    O365
    Posts
    16

    Re: Extracting text from a string

    Thanks I appreciate the info but we use office 365. I don't believe Power Query has that functionality with O365.
    Last edited by AliGW; 01-21-2022 at 11:48 AM. Reason: PLEASE don't quote unnecessarily!

  12. #12
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,884

    Re: Extracting text from a string

    Power Query is called Get and Transform Data in O365 and is found on the Data Tab. It has been part of Excel since version 2010 for those running on Windows.

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

    Re: Extracting text from a string

    Please upload a representative sample AND some manually calculated expected results.

    In the meantime, does this do anything for you?


    =FILTERXML("<A><B>"&SUBSTITUTE(SUBSTITUTE(I2,"@","."),".","</B><B>")&"</B></A>","//B[position () = 2]")

    copied down.
    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.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  14. #14
    Registered User
    Join Date
    11-15-2021
    Location
    Gatineau, Canada
    MS-Off Ver
    O365
    Posts
    16

    Re: Extracting text from a string

    So the formula didn't work at first, it would give me the last name before the at symbol and when I copied it to the next cell it provided a Ref# error. So I adjusted the formula to [position () = 3] and it gave me the expected result. So I copied it to the next cell, changed the reference to I3 and it worked again, so then I double clicked the box in the bottom right of the cell and it copied, properly, the formula down 5200 rows. Identifying which companies are using how many licenses.


    Seriously can't say thank you enough!!!! Hope you have a great weekend!!!

    Thank you.

    Just an FYI the formula works if the email is first dot last if say their email is lastfir then you have to manually edit the formula to change to position 2 again. AND if say they have first dot middle dot last then you have to manually change to position 4, other than that, it's great. There were only about 20 that had to be manually adjusted, far cry from the 5200 I was looking at.
    Last edited by AliGW; 01-21-2022 at 11:48 AM. Reason: PLEASE don't quote unnecessarily!

  15. #15
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,445

    Re: Extracting text from a string

    It's pretty tough to second guess what may or may not be there depending on what you have removed for whatever reason.

    Post desensitised samples of email addresses that truly represent what your data looks like. And include expected results. My expectation was that if you have company.company then you need company not company.company.

    We're wasting a lot of time here for what should be a trivial request.

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

    Re: Extracting text from a string

    Grand. But next time, please upload a sample WITH expected results, right from the start.

  17. #17
    Registered User
    Join Date
    11-15-2021
    Location
    Gatineau, Canada
    MS-Off Ver
    O365
    Posts
    16

    Re: Extracting text from a string

    Quote Originally Posted by TMS View Post
    It's pretty tough to second guess what may or may not be there depending on what you have removed for whatever reason.
    Sorry I had uploaded a spreadsheet, I didn't realize that I need to include expected manual entries, I literally have 12 or 13 posts here. I'm new, again. Sorry. I'll know for next time.
    Last edited by AliGW; 01-21-2022 at 11:49 AM. Reason: PLEASE don't quote unnecessarily!

  18. #18
    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,830

    Re: Extracting text from a string

    I'm still waiting to hear back from you in your earlier thread ...
    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.

  19. #19
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,445

    Re: Extracting text from a string

    You did tell us what you wanted ... but that wasn't what you wanted.

    I would like to extract the word between at and the first dot so JohnDoe at company 1 dot com JaneSmith at company 2 dot com Steve stevenson at company 3 dot com
    JohnDoe@company 1.com
    JaneSmith@company 2.com
    Steve stevenson@company 3.com

  20. #20
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,445

    Re: Extracting text from a string

    So, this should give you what I think you want.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    copied down
    or just:
    Formula: copy to clipboard
    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. [SOLVED] Extracting text value from string
    By dchubbock in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-20-2015, 07:56 AM
  2. [SOLVED] Extracting a text string from a URL, almost there
    By Timmy22 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-25-2014, 01:26 PM
  3. Extracting text from a string
    By AlexDeLara in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-26-2014, 04:41 AM
  4. Extracting numbers and text from inconsistent text/number formatted string
    By Brandivil in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-25-2013, 01:46 PM
  5. [SOLVED] Extracting Text from a string of Text & Digits of variable length
    By hastex in forum Excel General
    Replies: 6
    Last Post: 06-06-2012, 09:11 AM
  6. Extracting text from a string
    By excelhelp18 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-05-2008, 05:43 AM
  7. Extracting just the last name in a text string
    By braydon16 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-26-2008, 11:33 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