+ Reply to Thread
Results 1 to 8 of 8

Fill down multiple columns with the values based on groupings from another column

  1. #1
    Registered User
    Join Date
    12-20-2021
    Location
    Cleveland, OH
    MS-Off Ver
    Office 365
    Posts
    5

    Question Fill down multiple columns with the values based on groupings from another column

    Attached is a pretend products export from Shopify. For certain columns, Shopify only writes the values to the first product variant record and leaves subsequent records blank (See worksheet Original). They're assumed to be the same as the first record. However, this makes it hard to work with the data since you can't filter.

    ProductIDs do not get exported but instead Shopify relies on the Handle column as the unique identifier. How can I fill columns down with the value in the first record for each product, using the Handle as the means of identifying when to stop filling down that value? (See worksheet Desired) What I mean is, if you look at the Original worksheet, if we ignore the Handle, then "Sweatshirt" will fill down into the Ladies T-shirt Standard Product Type as well and that's not good. (See worksheet Undesired)

    To be clear, I don't know how to do any part of this. So I'd like a script to 1) By column, fill a value down for all records with the same Handle 2) Ideally do this for multiple specified columns in the same script.

    There are 32000 rows and 50 columns though I'll only need to do this for about 12 columns.

    Thanks!

    P.S. I have a subscription to Kutools but a) it doesn't reference a different column as a grouping mechanism and b) doesn't do multiple columns in one shot. (Took quite a few minutes just to test one column.)
    Attached Files Attached Files

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,865

    Re: Fill down multiple columns with the values based on groupings from another column

    I used Power Query also referred to Get and Transform Data and found on the Data Tab.

    Please Login or Register  to view this content.
    Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

    It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

    - Follow this link to learn how to install Power Query in Excel 2010 / 2013.

    - Follow this link for an introduction to Power Query functionality.

    - Follow this link for a video which demonstrates how to use Power Query code provided.
    Attached Files Attached Files
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    12-20-2021
    Location
    Cleveland, OH
    MS-Off Ver
    Office 365
    Posts
    5

    Re: Fill down multiple columns with the values based on groupings from another column

    Thank you! I never had the need and therefore never took the time to try Power Query.

    I have a couple of questions after visiting the links you provided as well as those in your signature.

    1) When I open Advanced Editor, there are a couple of transformations in there which were created(?) when I connected to the data source. Those are showing up as separate steps in the Applied Steps pane. However, when I pasted in the third line you provided (including placing a comma at the end of the preceding line), it doesn't do any FILLS, and it no longer displays the separate steps in the Applied Steps pane, instead displaying "products_export_1" (which is the filename of the original csv). What am I doing wrong? And in fact, when I use Transform-->Any Column-->Fill-->Down it also doesn't do anything.

    2) I don't see where in your code you use the "Handle" column's value to stop/restart the fill. Again, the concern being that a value is filled down through its own products past a blank "header" row, straight through into another product.

    Thanks!

  4. #4
    Forum Expert
    Join Date
    10-19-2021
    Location
    Brazil
    MS-Off Ver
    Office 365 V2401 w/ Win10 Home 64 Bit
    Posts
    2,014

    Re: Fill down multiple columns with the values based on groupings from another column

    Another way of fill down your sheet cells, in A1 press Ctrl + Shift + space bar, then press F5, select special button and then select Blank, in the sequence digit the formula =B2 then Ctrl + Enter.
    From that Ctrl + Home, then press Ctrl + Shift + space bar, then Ctrl + C then Ctrl + Alt + V, then press V again and then Enter.

    If you wish you can deselect D22:D31 in this process too pressing Ctrl and using the mouse pointer before using the formula. B3 must be selected again in this case.
    Attached Files Attached Files
    Last edited by DJunqueira; 12-20-2021 at 06:43 PM.

  5. #5
    Registered User
    Join Date
    12-20-2021
    Location
    Cleveland, OH
    MS-Off Ver
    Office 365
    Posts
    5

    Re: Fill down multiple columns with the values based on groupings from another column

    I figured out the answer to #1. That I had to have null values not empty strings in order for fill to work. Still wondering about #2.

  6. #6
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: Fill down multiple columns with the values based on groupings from another column

    If any of the other suggestions does not strike your fancy, you can try this.
    Please Login or Register  to view this content.

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: Fill down multiple columns with the values based on groupings from another column

    VBA
    Please Login or Register  to view this content.

  8. #8
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,865

    Re: Fill down multiple columns with the values based on groupings from another column

    2) I don't see where in your code you use the "Handle" column's value to stop/restart the fill. Again, the concern being that a value is filled down through its own products past a blank "header" row, straight through into another product.
    With PQ, I did not use the Handler column as it was not necessary given the current arrangement/layout. If you have a different layout, then I would tackle it differently. Is your sample not representative of your actual data??

+ 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. Sum up values from a column based on multiple criteria from different columns
    By Snehith Moturi in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-26-2020, 08:00 PM
  2. Automate fill in of values in 1 column based on data from other columns
    By Plohish in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-09-2020, 12:49 PM
  3. Macro to Insert 4 Columns from Column E and fill repeated values in inserted columns
    By acsishere in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-07-2019, 10:18 PM
  4. Sum values in one column based on Criteria in Multiple Columns
    By jcjc7 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-27-2017, 02:05 AM
  5. Vlookup to auto-fill multiple columns based off 1 column
    By forestavekids in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 09-21-2016, 08:40 PM
  6. Replies: 0
    Last Post: 10-01-2014, 12:16 PM
  7. [SOLVED] VBA fill in cells in a new column in table based on multiple criteria from other columns
    By HRA in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-14-2013, 06:48 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