+ Reply to Thread
Results 1 to 4 of 4

When multiple values exist within a cell, copy rest of cells into row(s)

  1. #1
    Registered User
    Join Date
    09-14-2022
    Location
    Edinburgh, Scotland
    MS-Off Ver
    o365
    Posts
    2

    When multiple values exist within a cell, copy rest of cells into row(s)

    Sorry for the confusing title.

    I am looking to create terraform configuration files based on CSVs we receive with the relevant information.

    For the most part 1 row = 1 config, and each cell in a row has one piece of information. but occasionally there is a cellthat has multiple values in it. Either in the form of ports separated by commas, like this:

    7000, 7001, 7002, 7003

    Or in the form of IP addresses, seperated by newlines, like this:

    10.0.0.1/32

    10.0.0.2/32

    10.0.0.3/32

    10.0.0.4/32

    Is it possible with a programmatically or otherwise to go through the excel sheet, and whenever one of these scenarios is encountered, the whole row is copied to a new row with the rest of the cells in that row remaining the same, but with an individual port or IP address per row.

    Fun twist = some rows, will contain two or more cells with multiple values in them, so any solution would need to move procedurally through the sheet.

    Thanks!
    Attached Files Attached Files
    Last edited by yeahdj; 09-14-2022 at 12:53 PM. Reason: attachments

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: When multiple values exist within a cell, copy rest of cells into row(s)

    Fast answers need visual help. Please read the yellow banner at the top of this page on how to attach a file.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    09-14-2022
    Location
    Edinburgh, Scotland
    MS-Off Ver
    o365
    Posts
    2

    Re: When multiple values exist within a cell, copy rest of cells into row(s)

    Apologies, I have added attachments to the OP.

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,567

    Re: When multiple values exist within a cell, copy rest of cells into row(s)

    Here is a proposal that employs Get & Transform (Power Query).
    1. Convert the "Before" data into an Excel table (Ctrl + t)
    2. In Power Query replace the default code with:
    Please Login or Register  to view this content.
    Note that I named the "Before" table tblBefore whereas Excel will likely automatically name it Table1, so either change the name to tblBefore prior to loading it into Power Query or the name in the Source line of code from tblBefore to Table1.
    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

+ 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. only sum cells with values, ignore the rest
    By RINGLEADER in forum Excel General
    Replies: 3
    Last Post: 08-14-2019, 07:59 AM
  2. Replies: 1
    Last Post: 04-03-2019, 10:19 AM
  3. [SOLVED] Need to combine cells to one string of text if duplicate values exist in multiple cells
    By Chris McGlothen in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 02-17-2017, 09:13 PM
  4. Copy cells based on multiple cell values
    By Richard Brook in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-11-2013, 09:58 AM
  5. Copy and Paste certain values to a different row while not moving over the rest
    By mcculltc in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-25-2013, 09:45 AM
  6. Replies: 1
    Last Post: 09-09-2012, 07:25 PM
  7. Values not coming in few cell but coming in rest all cells
    By rashmib in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-02-2009, 11:19 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