+ Reply to Thread
Results 1 to 16 of 16

Extracting data from a cell and inserting into an adjacent cell

  1. #1
    Forum Contributor
    Join Date
    04-25-2011
    Location
    Donegal, Ireland
    MS-Off Ver
    Excel 2013
    Posts
    133

    Extracting data from a cell and inserting into an adjacent cell

    Hi,
    I'm looking to see if it's possible to extract the product codes from a cell and insert them in an adjacent cell.

    In the sample provided you'll see product descriptions in Col C for a variety of products that we use.

    HP always use **-****** 2 letters, a dash followed by a 6 or 7 mixture of numericals and letters
    MSI use 4-5 digits, a dash followed by 3 more etc.

    If it is possible i'd like to extract these codes into the adjacent cell in Col B

    Many thx in advance guys

    John
    Attached Files Attached Files
    Last edited by JohnnyBoyxxx; 04-07-2017 at 01:37 PM.

  2. #2
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Extracting data from a cell and inserting into an adjacent cell

    In your example sheet, can you show the output you want in column B for a handful of the codes in column A? It's not really clear to me what you're wanting
    I'm interested in starting a career working with VBA, if anyone knows of any opportunities!

  3. #3
    Forum Contributor
    Join Date
    04-25-2011
    Location
    Donegal, Ireland
    MS-Off Ver
    Excel 2013
    Posts
    133

    Re: Extracting data from a cell and inserting into an adjacent cell

    Hi, Thx for your response,

    I've updated the sample to reflect your request. NOTE; The codes need to be extracted from Column C

  4. #4
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Extracting data from a cell and inserting into an adjacent cell

    Are Toshiba, Dell, HP, MSI, Asus, and Lenovo the only manufacturers you'll encounter? Are the products codes always the same format for each of them? If not, will they always bee in the same place in the string for each manufacturer? If not, I'd imagine there's too much intelligence involved to write a VBA script that could capture 100% of the codes.

  5. #5
    Forum Contributor
    Join Date
    04-25-2011
    Location
    Donegal, Ireland
    MS-Off Ver
    Excel 2013
    Posts
    133

    Re: Extracting data from a cell and inserting into an adjacent cell

    I would say that 95% of our product range is between HP, Asus and MSI and they are pretty consistence with there codes.The rest i'm not too bothered about. If there was anything that would help erase the manual aspect of copy and pasting that i'm doing now, it would be a huge help.

    Regards
    John

  6. #6
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,380

    Re: Extracting data from a cell and inserting into an adjacent cell

    Hi JohnnyBoyxxx

    You can give this a try
    Please Login or Register  to view this content.
    Last edited by sintek; 04-08-2017 at 04:21 AM.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

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

    Re: Extracting data from a cell and inserting into an adjacent cell

    JohnnyBoyxxx

    This extracts correct result based on data uploaded.
    Upload more different data if this does not extract correct string for actual data.
    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    04-25-2011
    Location
    Donegal, Ireland
    MS-Off Ver
    Excel 2013
    Posts
    133

    Re: Extracting data from a cell and inserting into an adjacent cell

    Hi, This forum is amazing, many thanks to sintek and jindon for your replies and efforts in answering my query.

    The solution provided by sintek worked but with a few discrepencies but jindon's solution worked virtually perfectly.

    I've updated the sample with jindons macro that shows a tiny issue with the data for the HP Pavilion X2's on lines 21 & 24-27 but as these were not in the original sample this is totally my fault.

    Thx again guys for all your efforts
    Attached Files Attached Files

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

    Re: Extracting data from a cell and inserting into an adjacent cell

    JohnnyBoyxxx

    I also need the results that you want...

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

    Re: Extracting data from a cell and inserting into an adjacent cell

    Quote Originally Posted by JohnnyBoyxxx View Post
    I've updated the sample with jindons macro that shows a tiny issue with the data for the HP Pavilion X2's on lines 21 & 24-27 but as these were not in the original sample this is totally my fault.
    Since you didn't show me the result that you want, tihis is only my guess.
    Change pattern to
    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    04-25-2011
    Location
    Donegal, Ireland
    MS-Off Ver
    Excel 2013
    Posts
    133

    Re: Extracting data from a cell and inserting into an adjacent cell

    Hi Jindon,
    My apologies, i've updated the sample sheet and you'll notice the formula brings in the results for HP Pavilion X2 lke row 24. The results i'm hoping for are on row 25 and 26.

    Regards
    John
    Attached Files Attached Files

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

    Re: Extracting data from a cell and inserting into an adjacent cell

    What about row 21?
    Is it for series of "HP Pavilion" only?

  13. #13
    Forum Contributor
    Join Date
    04-25-2011
    Location
    Donegal, Ireland
    MS-Off Ver
    Excel 2013
    Posts
    133

    Re: Extracting data from a cell and inserting into an adjacent cell

    The code for row 25-26 is what it should look like, rows 21 and 24 is what the formula gives me. The X2 is not part of the code and only represents a model type.
    We have other HP Pavilions that do not have the X2 in their description and the formula works fine for them.

    What you've provided me with so far sorts over 95% of my product range so i'm really happy, a real time saver so many many thanks.

    It is only a few products that have this issue and I really don't mind the odd manual adjustment, I feel i've taken enough of your time.

    regards
    John

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

    Re: Extracting data from a cell and inserting into an adjacent cell

    Try this one
    Please Login or Register  to view this content.

  15. #15
    Forum Contributor
    Join Date
    04-25-2011
    Location
    Donegal, Ireland
    MS-Off Ver
    Excel 2013
    Posts
    133

    Re: Extracting data from a cell and inserting into an adjacent cell

    Works a treat, absolutely brilliant time saver for me.

    Thank you very much for everything

    Regards
    John

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

    Re: Extracting data from a cell and inserting into an adjacent cell

    You are welcome and any further adjustment in future, just post back.

+ 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 help with writing a formula by extracting the divisor used in adjacent cell.
    By sanmitramishra in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-07-2016, 07:10 AM
  2. Replies: 3
    Last Post: 07-21-2015, 05:10 PM
  3. Copying data from adjacent cell to blank cell (left side)
    By raghunaik in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-14-2015, 08:20 AM
  4. [SOLVED] Inserting Values in a Cell Depending on Content in an Adjacent Cell
    By lowlybroker in forum Excel General
    Replies: 3
    Last Post: 03-20-2014, 01:23 PM
  5. Pulling email address from irrelevant data within cell and inserting in adjacent column
    By SouthFloridaBadger in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 09-05-2013, 04:28 PM
  6. [SOLVED] Copying today's date into cell when multiple data is entered into adjacent cell
    By SChapman in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 04-16-2013, 04:12 PM
  7. Replies: 4
    Last Post: 02-11-2013, 07:35 PM

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