+ Reply to Thread
Results 1 to 3 of 3

Copy data in column based on data from another

  1. #1
    Registered User
    Join Date
    12-15-2014
    Location
    Spokane, WA
    MS-Off Ver
    Office Professional 2007
    Posts
    7

    Question Copy data in column based on data from another

    Hi all!

    I have a conundrum that I can't quite seem to square out and am hoping someone can help. Here it is:

    I have a worksheet called "Location". Within this worksheet is data in column B starting on row 3. The user selects the data by placing a corresponding "X" in column A. I'd like to have a code/formula that says, If there is an "X" in column A, copy the data starting in row 31 without empty rows. So this:

    ___A___|_____B___|
    1___X___|__Orange_|
    2_______|__Apple__|
    3___X___|__Pear___|

    Would be copied as:

    __|__A____|____B____|
    1_|__X____|__Orange_|
    2_|_______|__Apple__|
    3_|__X____|__Pear___|
    ...|_______|_________|
    31|_Orange|_________|
    32|_Pear__|_________|

    I've tried "IF" formulas, but they don't skip the blanks (or cause redundancies in the copied data), and I haven't been able to get a macro to do it either. I've tried to look up some examples, but they all deal with moving the data to a different sheet and the code does not work for copying to the same sheet.

    Any suggestions?

    Thanks!

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,704

    Re: Copy data in column based on data from another

    Put this formula in C1:

    =IF(A1="X",COUNTIF(A$1:A1,"X"),"")

    and copy down. Then in A31 you can have this formula:

    =IFERROR(INDEX(B:B,MATCH(ROWS($1:1),C:C,0)),"")

    then copy this down.

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    12-15-2014
    Location
    Spokane, WA
    MS-Off Ver
    Office Professional 2007
    Posts
    7

    Re: Copy data in column based on data from another

    That worked perfectly! Thanks a ton!

+ 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] Copy data from column to other sheets, based upon vlookup/criteria on column a
    By jedemeyer1 in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 03-27-2013, 04:01 AM
  2. copy data based on column A
    By legolas in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 11-11-2010, 03:02 AM
  3. Replies: 2
    Last Post: 03-16-2009, 12:26 PM
  4. Copy Formula down the column based on data in the next column
    By karl_009 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-02-2008, 09:48 AM
  5. Copy data from one worksheet based on column....
    By alexjamesbrown in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-28-2007, 09:54 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