+ Reply to Thread
Results 1 to 5 of 5

Grabbing data in a worksheet and transposing in another... or something like that!

  1. #1
    Registered User
    Join Date
    02-09-2014
    Location
    Montreal
    MS-Off Ver
    Excel 2010
    Posts
    2

    Grabbing data in a worksheet and transposing in another... or something like that!

    This is probably a very simple formula, but after doing my best with VLOOKUP, HLOOKUP and IF... I just can't figure it out! I have a spreadsheet with up to 10,000 rows in column A. Here is an example:
    A
    1 Case Number
    2 123456
    3
    4 Name
    5 Joe
    6
    7 Case Number
    8 98765
    9
    10 Name
    11 Bill
    12
    13 Case Number
    14 112233

    What I want to do is, in a new worksheet starting at cell A2 scan the above sheet and every time I find “Case Number” display the value underneath (even if it is blank). Then proceed to cell A3, find the next “Case Number” again and display the next value below. Like this:

    A
    1 Case Number
    2 123456
    3 98765
    4 112233

    The only other constraint I should mention is the number of rows between subsequent “Case Number”s on the first sheet is not always the same, so I can't use a formula that says “go down exactly 6 rows each time and grab those values”. Row distances between case numbers is effectively random at times.

    Maybe I need a macro and not a formula? Any help would be greatly appreciated!

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,942

    Re: Grabbing data in a worksheet and transposing in another... or something like that!

    Hi and welcome to the forum

    Try this. I added a helper column in B, and copied this in B2, and then copied down....
    =IF(A2="Case Number",B1+1,B1)

    Then on sheet2, A2, I used this, copied down...
    =IFERROR(INDEX(Sheet1!A:A,MATCH(ROWS(Sheet1!$A$1:A1),Sheet1!B:B,0)+1),"")
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    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,905

    Re: Grabbing data in a worksheet and transposing in another... or something like that!

    In addition to Ford's solution, if you are interested, here is a VBA solution as another option.

    Please Login or Register  to view this content.
    How to install your new code
    1. Copy the Excel VBA code
    2. Select the workbook in which you want to store the Excel VBA code
    3. Press Alt+F11 to open the Visual Basic Editor
    4. Choose Insert > Module
    5. Edit > Paste the macro into the module that appeared
    6. Close the VBEditor
    7. Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)

    To run the Excel VBA code:
    1. Press Alt-F8 to open the macro list
    2. Select a macro in the list
    3. Click the Run button
    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

  4. #4
    Registered User
    Join Date
    02-09-2014
    Location
    Montreal
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Grabbing data in a worksheet and transposing in another... or something like that!

    Wow that was fast, you guys RULE! You have saved me soooo much time! You are the BEST!!

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,942

    Re: Grabbing data in a worksheet and transposing in another... or something like that!

    Happy to help and thanks for the feedback

+ 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. Replies: 9
    Last Post: 01-31-2013, 01:58 AM
  2. Grabbing Data VBA
    By lienlee in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-23-2010, 01:48 PM
  3. Transposing data from one worksheet to another
    By meowzers in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-02-2010, 01:28 PM
  4. Grabbing and sorting info from another worksheet.
    By Coop913 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 10-13-2009, 01:32 PM
  5. Replies: 29
    Last Post: 06-08-2009, 10:37 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