+ Reply to Thread
Results 1 to 18 of 18

Extract first 3 strings in 3 different cells

  1. #1
    Forum Contributor
    Join Date
    05-22-2015
    Location
    Malaysia
    MS-Off Ver
    MS365
    Posts
    197

    Extract first 3 strings in 3 different cells

    Hi,

    Would like to have a formula to separate first 3 strings by " :" in 3 different cells

    Hostname1.gmail.com :C4_F6_AM_REB_DF3_MCS_ESA_DB :1 :Backup1
    Cell1 Hostname1
    Cell2 Name
    Cell2 Number

    Hostname2 :C4_F6_AM_AA_DF3_MCS_ESA_DB :2 :Backup2
    Cell1 Hostname2
    Cell2 Name
    Cell3 Number

    Cell1 (I just need to retrieve the hostname but it has 2 different separators which is " :" and "." Please advise to combine below formula.
    =LEFT(T3,FIND(" ",SUBSTITUTE(T3,":"," ",2))-1)
    =LEFT(T3,FIND(" ",SUBSTITUTE(T3,"."," ",2))-1)

    I also need to separate the string for 2nd and 3rd string as well.

    Please give your advise. Thank you.

  2. #2
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: Extract first 3 strings in 3 different cells

    Like this?
    =LEFT(T3,FIND(" ",SUBSTITUTE(T3,MID(T3,11,1)," ",2))-1)
    Teach me Excel VBA

  3. #3
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Extract first 3 strings in 3 different cells

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


    if yes, use Text to columns twice

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,169

    Re: Extract first 3 strings in 3 different cells

    Try

    in B1 and copy across

    =TRIM(MID(SUBSTITUTE($A1,":",REPT(" ",250)),(COLUMNS($A:A)-1)*250+1,250))

  5. #5
    Forum Contributor
    Join Date
    05-22-2015
    Location
    Malaysia
    MS-Off Ver
    MS365
    Posts
    197

    Re: Extract first 3 strings in 3 different cells

    Hi John,
    =TRIM(MID(SUBSTITUTE($A1,":",REPT(" ",250)),(COLUMNS($A:A)-1)*250+1,250)) worked well.

    But in Cell 1, I have 2 different string of hostname which is as follows. Would like to retrieve the hostname only. Please advise.

    Hostname1.gmail.com : (dot)
    Hostname2 : (Colon)

  6. #6
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Extract first 3 strings in 3 different cells

    Did you try Text to columns?
    Faster, easier, not copied/duplicated data, everything what are you doing is on A column only
    but it's up to you

  7. #7
    Forum Contributor
    Join Date
    05-22-2015
    Location
    Malaysia
    MS-Off Ver
    MS365
    Posts
    197

    Re: Extract first 3 strings in 3 different cells

    Yes I know how to use the Text columns but I'm just saving time to prepare report every morning.

  8. #8
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Extract first 3 strings in 3 different cells

    If I understand well source data will stay as well result in the same worksheet, and every morning you want to use formula to get new result?

  9. #9
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,169

    Re: Extract first 3 strings in 3 different cells

    Do you mean ?

    Hostname1.gmail.com . Hostname2 : C4_F6_AM_REB_DF3_MCS_ESA_DB :1 :Backup1

    Post sample fle

    To attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  10. #10
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Extract first 3 strings in 3 different cells

    John, look at #3, it should looks like there (probably)

  11. #11
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,169

    Re: Extract first 3 strings in 3 different cells

    in B1

    =LEFT(A1,FIND(".",A1)-1)

    in C1

    =TRIM(MID(SUBSTITUTE($A1,":",REPT(" ",250)),(COLUMNS($A:B)-1)*250+1,250))

    Copy across to D

  12. #12
    Forum Contributor
    Join Date
    05-22-2015
    Location
    Malaysia
    MS-Off Ver
    MS365
    Posts
    197

    Re: Extract first 3 strings in 3 different cells

    Sorry for the confusion

    The purpose of doing this is that I'm designing a dashboard. To save time in preparing the report, users will just need to copy and past the raw data.
    On the right side of the raw data, formulas are set to populate the trending to find the gaps to further discuss on reoccurance and failures.
    Attached Files Attached Files

  13. #13
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,907

    Re: Extract first 3 strings in 3 different cells

    Try this ...

    In B3:

    =MID(SUBSTITUTE($A3,":",REPT(" ",255)),255,255)

    In C3:

    =MID(SUBSTITUTE($A3,":",REPT(" ",255)),255,255)

    In D3:

    =LOOKUP(10^10,--LEFT(TRIM(MID(SUBSTITUTE($A3,":",REPT(" ",255)),510,255)),{1,2,3,4,5,6,7,8,9}))

  14. #14
    Forum Contributor
    Join Date
    05-22-2015
    Location
    Malaysia
    MS-Off Ver
    MS365
    Posts
    197

    Re: Extract first 3 strings in 3 different cells

    Hi Phuocam

    In B3:
    I have changed from MID to Left but it's not working for hostname3.group.abc.com. I just need the hostname3 in the same cell.
    I also found out that it also created so many spaces.

    =LEFT(SUBSTITUTE($A3,":",REPT(" ",255)),255,255)


    In C3:
    This formula works but it created so many spaces when double click the column.
    =MID(SUBSTITUTE($A3,":",REPT(" ",255)),255,255)

    Attached is the results.
    Attached Files Attached Files

  15. #15
    Forum Contributor
    Join Date
    05-22-2015
    Location
    Malaysia
    MS-Off Ver
    MS365
    Posts
    197

    Re: Extract first 3 strings in 3 different cells

    JohnTopley's formula =TRIM(MID(SUBSTITUTE($A1,":",REPT(" ",250)),(COLUMNS($A:B)-1)*250+1,250)) worked for Cell C3.

    Only struggling for Cell B3 where I need to populate hostname only.
    Please advise.

  16. #16
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,907

    Re: Extract first 3 strings in 3 different cells

    Sorry, try again:

    In B3:

    =LEFT(A3,FIND(":",SUBSTITUTE($A3,".",":"))-1)

    In C3:

    =TRIM(MID(SUBSTITUTE($A3,":",REPT(" ",255)),255,255))


  17. #17
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,169

    Re: Extract first 3 strings in 3 different cells

    In B3

    =LEFT(A3,FIND(":",SUBSTITUTE($A3,".",":"))-1)

    in C3

    =TRIM(MID(SUBSTITUTE(SUBSTITUTE($A3,"(",":"),":",REPT(" ",250)),(COLUMNS($A:B)-1)*250+1,250))

    drag to D3

    See E, F, G in attached
    Attached Files Attached Files

  18. #18
    Forum Contributor
    Join Date
    05-22-2015
    Location
    Malaysia
    MS-Off Ver
    MS365
    Posts
    197

    Re: Extract first 3 strings in 3 different cells

    Hi Phuocam and John,

    Wow!! I didn't know by simply adding another separator within the formula.
    Appreciate for the efforts, both the formulas worked.

    Thank you.

+ 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. Need to extract years (and other info) from strings of text in a column of cells
    By Gene@action in forum Excel Programming / VBA / Macros
    Replies: 48
    Last Post: 10-13-2016, 09:07 PM
  2. [SOLVED] Formula to extract strings
    By sharathnarayanan in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 11-13-2015, 03:53 AM
  3. [SOLVED] How to extract strings from hyphen separated strings
    By sharathnarayanan in forum Excel General
    Replies: 5
    Last Post: 11-22-2014, 10:01 AM
  4. Extract common text strings between two cells A1 B1
    By ghost_chip in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-25-2013, 01:39 AM
  5. [SOLVED] Extract unique strings from excel cells across rows and columns
    By quedan in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 01-28-2013, 02:42 PM
  6. [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
  7. HOW TO EXTRACT STRINGS FROM CELLS
    By vidhya in forum Excel General
    Replies: 2
    Last Post: 11-17-2005, 08:45 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