Results 1 to 3 of 3

Thread: How to auto-copy column between sheets, based on a cell value

  1. #1

    Question How to auto-copy column between sheets, based on a cell value



    Register for a FREE account, and/
    or Log in to avoid these ads!

    Guys, please help! I've been trying to do this for the last 5 hours!

    I have an excel 2010 file with two sheets. Sheet 1 has some functions that make calculations like this: Column A is the "input" data, and all other columns make calculations based on column A data. Sheet 2 has some sample data in columns, which i am currently manually copy-pasting to Sheet 1 column A in order for sheet 1 to make the calculations. So every time i want to change the set of data, i have to copy-paste a column from sheet 2 to sheet 1- column A.

    What i want to do:

    I want to have a specific cell in sheet 1 that will act like this when i manually enter values to it:

    If entered value in that cell = A, then copy sheet2columnA to Sheet1columnA
    If entered value in that cell = B, then copy sheet2columnB to Sheet1columnA
    If entered value in that cell = C, then copy sheet2columnC to Sheet1columnA (notice that the destination is always the same, but the origin of data is based on my input)
    etc... so that i just manually enter A, B or C to that specific cell, and it automatically changes the values in Sheet 1 Column 1 by taking data from the sheet 2 column that refers to my input.

    If you can tell me how to do this, you have both my warm thank you and my respect.
    Thank you in advance

  2. #2
    Administrator Ken Puls's Avatar
    Join Date
    Mar 2011
    Location
    Nanaimo, BC, Canada
    Posts
    2,274
    Articles
    57
    Blog Entries
    14
    Excel Version
    Excel Office 365 Insider
    Assuming your cell that you're driving it from is B2, and the data you're after is in row 2 of Sheet 1, then this should work:
    Code:
    =IF($B$2="A",Sheet2!B4,IF($B$2="B",Sheet2!C4,Sheet2!C4))
    Copy that down and you'll get the rows below to come over as well.
    Ken Puls, FCPA, FCMA, MS MVP

    Learn to Master Your Data at the Power Query Academy (the world's most comprehensive online Power Query training), with my book M is for Data Monkey, or our new Power Query Recipe cards!

    Main Site: http://www.excelguru.ca -||- Blog: http://www.excelguru.ca/blog -||- Forums: http://www.excelguru.ca/forums
    Check out the Excelguru Facebook Fan Page -||- Follow Me on Twitter

    If you've been given VBA code (a macro) for your solution, but don't know where to put it, CLICK HERE.

  3. #3
    Wonderful! thank you!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •