+ Reply to Thread
Results 1 to 4 of 4

Import Column based on Column Header name

  1. #1
    Registered User
    Join Date
    02-10-2014
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2013
    Posts
    25

    Import Column based on Column Header name

    Learning as go again....

    I have a CSV file with names on the Column Headers (i.e. LastName, City, OS Type). I only want to import certain columns, based on column header name (i.e. LastName, OStype) into a new worksheet, and into a specific column order (which is different from the order they are in the CSV).

    I am able to import the CSV file by column (i.e. A/1st), but I want by column header (i.e. LastName). Any suggsetions where to start when using column header name?

    Thx,
    J.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,330

    Re: Import Column based on Column Header name

    Hi Julie,

    I believe you will need to import the entire csv file and then delete the columns you don't want. A VBA macro might be useful here if you have lots of these to do. If you supply a small sample of the csv file and note the column names you want to keep and in what order, we can whip up some code to do what you want.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    02-10-2014
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2013
    Posts
    25

    Re: Import Column based on Column Header name

    I provided an example using a different CSV file; "export" worksheet would be the source data. The result is, I only want column "Area", "Status", "Start", "End" imported into the new destination worksheet.

    The actual export file could have 10-22 columns and 300-900 rows of data.

    Note: The 'export' file, the columns will not be in an consistent order each time the data is exported from the source application (this is due the export is being performed by different teams / different source setup). Example: "Area" might be column C on Monday's export, and in column A on Friday's export.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Import Column based on Column Header name

    Maybe:

    Please Login or Register  to view this content.

+ 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. macro to lock cell by column header based on value in another cell by column header
    By Closet Guru in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-03-2015, 12:36 PM
  2. Find Column Number Based on Column Header
    By chicagoland8 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-09-2014, 11:58 AM
  3. Return column header based on column criteria and number value
    By bwill22 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-07-2014, 07:33 PM
  4. Replies: 1
    Last Post: 01-30-2014, 01:42 PM
  5. Replies: 1
    Last Post: 01-30-2009, 07:40 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