+ Reply to Thread
Results 1 to 4 of 4

Copying a row of data based on a category

  1. #1
    Forum Contributor
    Join Date
    03-24-2010
    Location
    North West UK
    MS-Off Ver
    2013
    Posts
    112

    Copying a row of data based on a category

    Hi,

    I am trying to develop a spreadsheet (attached to this post), what I would like to do in the Contents tab is have a drop down list in every cell from A2 downwards (only in column A though). When clicking on this drop down list it will display all the categories that are listed in the Category tab (this list may increase). When the user selects a category from this list it is displayed in column A on the Contents tab.

    What I want to do then is for whatever data I put in each row is copied to the tab that relates to the category.

    So for example, let's say my first entry is that on the Contents Tab in Cell A2 there's a drop down and I choose Photos (which is one of the categories list on that tab), I then type date in columns/cells: B2, C2, D2 etc then everything from A2 to D2 (or beyond that to even Y2) is copied to the photos tab from column A onwards. My further issue is that if I then enter another Photo category, I want it to again copy the data but put it under the line that's already been copied there from the previous entry. Bascially, everything entered into the Contents tab is all copied to the appropriate tabs. The contents tab shows all entries.

    I hope that makes sense!

    Thanks,
    Lew
    Attached Files Attached Files

  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,946

    Re: Copying a row of data based on a category

    To start with, please update your profile to show the excl version you are using. Members use this to tailor suggestions for you (earlier versions of excel dont have all the finctions that later 1's do)

    Assuming you are using 2010 or later....
    make sure you are in A2
    click the Data tab/data Validation.
    Under Allow, select List
    Under Source, highlight the range on categories (plus a few extra cells...=Categories!$A$1:$A$20) We could make this dynamic, but if it wont grow much/often, we can keep it manual
    click OK

    You now have a DD in A2, which you can copy down as needed

    To do the copying from there to whichever sheet you choose, will require VBA, which is not my strong side, but Im sure 1 of the other members will pick this up and help you further
    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 Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Copying a row of data based on a category

    Hi Finalfrontier,

    Here's event code to put the validation into any cell in the first column after row1 - but there seems to be no data to transfer?

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  4. #4
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Copying a row of data based on a category

    Here is a start for you.
    I put your CATEGORIES in a Table then used the header in the table to create the Data Validation list on the Contents worksheet. I filled in rows 2 to 20 with the Data Validation drop down lists.
    The data Validation formula is:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    The name is the entire column of the table so when additions or deletions are made, the drop down list will adjust accordingly.

    The formula used on all worksheets is exactly the same as they take the value that is in B1 which is the category for the worksheet. This is an ARRAY FORMULA so, enter with Ctrl + Shift + Enter.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    I entered this formula on the first few worksheets and filled across and down to N21. The area with the formulae is shaded with outlines on the cells so you can see where the formulae are. If you need more columns fill the formula across. If you need less, delete the excess columns.

    I corrected some of the categories on the CATEGORY worksheet as some entries had trailing spaces.

    Column A of each workbook is actually column B of the Contents Worksheet as there is no need to have the category repeated down the worksheets.

    I think that you should be able to follow the example worksheets to complete your workbook.

    NOTE: I unmerged the cells that you had as merged in the category worksheets and used B1 in each of the worksheets as the cell being referenced on all worksheets that I filled in.
    Attached Files Attached Files
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

+ 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. Getting 10 random numbers from a big range of data based on category
    By sabha in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-01-2014, 11:17 AM
  2. copy data to another sheet based on category selected
    By stoey in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-19-2013, 03:47 PM
  3. Sum numbers based on a category of a category
    By mattjac in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-09-2012, 11:08 PM
  4. [SOLVED] Data from one sheet to several based on category
    By Andy Roberts in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-02-2006, 03:25 PM
  5. [SOLVED] Summing Data based on Its Category
    By sip8316 in forum Excel General
    Replies: 2
    Last Post: 05-24-2005, 03:06 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