+ Reply to Thread
Results 1 to 25 of 25

Help Extracting Data- Probably VBA for looping?

  1. #1
    Registered User
    Join Date
    01-27-2018
    Location
    Oregon, USA
    MS-Off Ver
    Office 2016
    Posts
    15

    Question Help Extracting Data- Probably VBA for looping?

    Hi everyone,

    I am very rusty at my Excel skills, and it seems like I may need to use VBA with this one. I have a spreadsheet that is about 4000+ rows of data: Names, Access Levels, and card numbers. The problem is that there is one name associated with multiple rows of data, and it isn't consistent. Basically I need to take this data, and have the person's name, access levels, and card number in column format so that I can concatenate and put into CSV format.

    In the attached workbook, you'll see the raw data sheet, and then the desired result page. Is there a way to use the vlookup on a merged first cell with multiple adjacent rows, and dump that data into multiple columns like second example?

    Any assistance is greatly appreciated. I'm trying to help out a friend, and am now stuck on trying to figure it out because I want to.
    Attached Files Attached Files
    Last edited by flexchick; 01-27-2018 at 07:30 PM. Reason: Added Workbook

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

    Re: Help Extracting Data- Probably VBA for looping?

    If you upload a workbook with the sheets what you have and what you want as a result will help.
    Picture doesn't help usually.

    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.

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

    Re: Help Extracting Data- Probably VBA for looping?

    you can substitute char(10) with a space - char(32) in column Access Level then concatenate columns

    edit: forget it , you're using merged cells
    Last edited by sandy666; 01-27-2018 at 07:32 PM.

  4. #4
    Registered User
    Join Date
    01-27-2018
    Location
    Oregon, USA
    MS-Off Ver
    Office 2016
    Posts
    15

    Re: Help Extracting Data- Probably VBA for looping?

    Thanks- this is my first post here so I appreciate the advice.

  5. #5
    Registered User
    Join Date
    01-27-2018
    Location
    Oregon, USA
    MS-Off Ver
    Office 2016
    Posts
    15

    Re: Help Extracting Data- Probably VBA for looping?

    Thanks, but I know how to concatenate- it's getting the data into the columns in the first place that I need help with. Merged first column with multiple rows attached. I uploaded an example workbook since I did a crappy job of explaining what I needed. Thank you anyway!!

    The setup for the raw data was not my idea- I can unmerge cells, but that creates different problem or having blank cell associated with the data I need.
    Last edited by flexchick; 01-27-2018 at 07:37 PM.

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Help Extracting Data- Probably VBA for looping?

    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

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

    Cool Re: Help Extracting Data- Probably VBA for looping?

    or something like this with PowerQuery
    Attached Files Attached Files

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

    Re: Help Extracting Data- Probably VBA for looping?

    Try
    Please Login or Register  to view this content.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    01-27-2018
    Location
    Oregon, USA
    MS-Off Ver
    Office 2016
    Posts
    15

    Re: Help Extracting Data- Probably VBA for looping?

    Thank you. Each name and card number have merged cells, and the access levels vary in rowsize (anywhere from 1 to 4 access levels). How do I tell it to look up the name, and then copy the rows next to it to paste into columns on new worksheet, and then move to the next name? Can you tell me what I'm putting as the ranges? It would be so much easier if I could send the actual spreadsheet...lol.

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

    Re: Help Extracting Data- Probably VBA for looping?

    To whom you are talking?

  11. #11
    Registered User
    Join Date
    01-27-2018
    Location
    Oregon, USA
    MS-Off Ver
    Office 2016
    Posts
    15

    Re: Help Extracting Data- Probably VBA for looping?

    Sandy666, how did you get the merged name fields and accesses lined up in that power query?

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

    Cool Re: Help Extracting Data- Probably VBA for looping?

    here is M code:
    Please Login or Register  to view this content.


    Data - show queries - double click on Table 1 - Menu - Advanced Editor
    or look at Applied Steps in Query Settings (after open Table 1)

    Edit:
    If you want more see:
    Last edited by sandy666; 01-27-2018 at 09:15 PM. Reason: see edit

  13. #13
    Registered User
    Join Date
    01-27-2018
    Location
    Oregon, USA
    MS-Off Ver
    Office 2016
    Posts
    15

    Re: Help Extracting Data- Probably VBA for looping?

    Thanks bunches. For some reason, I'm not seeing Power Query in my Data tab- I have the regular query, but my build of 2016 must be different. There are about 4,000+ lines of data, and it looks like you manually created each of the merged columns? I already transposed the table, it was just getting it into that final format. It would be quicker to just cut and paste than create a query for each name?

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

    Re: Help Extracting Data- Probably VBA for looping?

    flexchick

    Have you tried my attachment in #8?

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

    Re: Help Extracting Data- Probably VBA for looping?

    Power Query in Ex2016 is called: Get&Transform

    gt.jpg

    Maybe your Excel is 365 not 2016 with a little different layout

    read more about PowerQuery / Get&Transform from links above
    Last edited by sandy666; 01-27-2018 at 09:42 PM.

  16. #16
    Registered User
    Join Date
    01-27-2018
    Location
    Oregon, USA
    MS-Off Ver
    Office 2016
    Posts
    15

    Re: Help Extracting Data- Probably VBA for looping?

    Thank you jindon- that one does what I need. Aside from making sure the sheet names are the same in .xlsm coding, what else will I need to change to get it to work on my larger dataset?

  17. #17
    Registered User
    Join Date
    01-27-2018
    Location
    Oregon, USA
    MS-Off Ver
    Office 2016
    Posts
    15

    Re: Help Extracting Data- Probably VBA for looping?

    Hi Sandy- I have 2016- and it shows as "Get and Transform" in my version. Thanks for all of the helpful information!

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

    Re: Help Extracting Data- Probably VBA for looping?

    You are welcome

    Why MS changed this name - I don't know
    but IMHO PowerQuery sounds much better than Get&Transform, eg. use Power (Query) Luke !

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

    Re: Help Extracting Data- Probably VBA for looping?

    Quote Originally Posted by flexchick View Post
    Thank you jindon- that one does what I need. Aside from making sure the sheet names are the same in .xlsm coding, what else will I need to change to get it to work on my larger dataset?
    It should work in any size of the data.
    If you have problem, I need to see your workbook.

  20. #20
    Registered User
    Join Date
    01-27-2018
    Location
    Oregon, USA
    MS-Off Ver
    Office 2016
    Posts
    15

    Re: Help Extracting Data- Probably VBA for looping?

    Thanks Jindon- can I private message you with this?

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

    Re: Help Extracting Data- Probably VBA for looping?

    PM sent...............

  22. #22
    Registered User
    Join Date
    01-27-2018
    Location
    Oregon, USA
    MS-Off Ver
    Office 2016
    Posts
    15

    Re: Help Extracting Data- Probably VBA for looping?

    Thanks- reply sent. Let me know what you think!

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

    Re: Help Extracting Data- Probably VBA for looping?

    OK, I see
    Just replace
    Please Login or Register  to view this content.
    with
    Please Login or Register  to view this content.
    And see how it goes.

  24. #24
    Registered User
    Join Date
    01-27-2018
    Location
    Oregon, USA
    MS-Off Ver
    Office 2016
    Posts
    15

    Re: Help Extracting Data- Probably VBA for looping?

    Jindon, it worked beautifully. Thanks again. That was so very helpful!!

    Thank you also to Sandy, and anyone else replying. This is a wonderful resource.

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

    Re: Help Extracting Data- Probably VBA for looping?

    You are welcome and thanks for the feedback.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

+ 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 and transposing data by looping
    By TexasBobcat in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-17-2015, 02:20 PM
  2. [SOLVED] Extracting data from table using VBA looping
    By TexasBobcat in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-17-2015, 01:17 PM
  3. [SOLVED] Extracting Data from Table by Looping
    By TexasBobcat in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-17-2015, 01:16 PM
  4. Extracting Data from Table By looping
    By TexasBobcat in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-17-2015, 01:16 PM
  5. Looping through multiple files in a folder and extracting data from a specific tab
    By Bandicoot in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-05-2013, 05:24 PM
  6. Looping thru files extracting data
    By gtslabs in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-03-2005, 12:05 PM

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