+ Reply to Thread
Results 1 to 16 of 16

Auto fill columns with data

  1. #1
    Forum Contributor
    Join Date
    12-30-2012
    Location
    Israel
    MS-Off Ver
    2007, 2016
    Posts
    642

    Auto fill columns with data

    Hi,
    This is a problem I'm trying to solve for a few days (the data itself is much bigger).
    It all explained in the sample file - I'd just add that there is a point I have hard time to solve:
    Here is the code I wrote but it "fails" in turning points like in A41 or A99.
    Thank you!
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Please * if you like the answer

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

    Re: Auto fill columns with data

    Try this:

    Please Login or Register  to view this content.
    Does this achieve your goal?
    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
    Forum Contributor
    Join Date
    12-30-2012
    Location
    Israel
    MS-Off Ver
    2007, 2016
    Posts
    642

    Re: Auto fill columns with data

    @Alan - thanks it looks good. But look at the errors in lines 96-100, where Columns B, C, D should be like A. Because there is a kind of hierarchy - A>B>C>D.

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

    Re: Auto fill columns with data

    Ah! I thought that may have been a typo in your file. I will look at it later today and see if I can be of help. No time right now. One question, however, If column A says Small Market, does that mean that columns B:D will always say small market?

  5. #5
    Forum Contributor
    Join Date
    12-30-2012
    Location
    Israel
    MS-Off Ver
    2007, 2016
    Posts
    642

    Re: Auto fill columns with data

    I appreciate this Alan! As to your question: not necessarily. You can think about columns A-D as categories in a decreasing rate of "importance". So if A96 = "Small market" and B96, C97, D97 are empty then yes line 96 of B-D will get the value of A96 ("Small market").

    Another way to think about it is Country-City-Quarter-Neighborhood. So if in line 96 all we have is the country name (column A) then the rest of this specific line columns (B-D) will get the value of the country name.

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

    Re: Auto fill columns with data

    Here is some revised code that I think should do the trick for you.

    Please Login or Register  to view this content.
    Shabat Shalom

  7. #7
    Forum Contributor
    Join Date
    12-30-2012
    Location
    Israel
    MS-Off Ver
    2007, 2016
    Posts
    642

    Re: Auto fill columns with data

    @Alan thanks, it's much better now.
    But still there is a problem with the range D93:D95 (see attached file).
    Actually this problem is general. The code gave the range D88:D100 the same value ("Packed_Cooled_Food") where actually the value in C93 ("Frozen_HotDog") should be "stronger" and so give the range D93:D100 its value ("Frozen_HotDog") rather than the value the code gave ("Packed_Cooled_Food").
    It's kind of a complicated hierarchy.
    Thanks again!
    Attached Files Attached Files

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

    Re: Auto fill columns with data

    What in your worksheet would trigger this? What would the logic be to that could be coded. Tell me in simple language the logic behind that using the concept if A then B but if C then D because I don't see this.

  9. #9
    Forum Contributor
    Join Date
    12-30-2012
    Location
    Israel
    MS-Off Ver
    2007, 2016
    Posts
    642

    Re: Auto fill columns with data

    Alan - all is explained, I hope in a good way, in the new sample file I attched.

    Thank you.
    Attached Files Attached Files

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

    Re: Auto fill columns with data

    This is beyond my abilities. I will refer to others to look at this.

  11. #11
    Forum Contributor
    Join Date
    12-30-2012
    Location
    Israel
    MS-Off Ver
    2007, 2016
    Posts
    642

    Re: Auto fill columns with data

    Ok - thanks for your efforts.

  12. #12
    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,433

    Re: Auto fill columns with data

    Maybe:

    Please Login or Register  to view this content.

    Regards, TMS
    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


  13. #13
    Forum Contributor
    Join Date
    12-30-2012
    Location
    Israel
    MS-Off Ver
    2007, 2016
    Posts
    642

    Re: Auto fill columns with data

    @TMS - Thank you, thank you! It definitely works with the sample file. Now I'll have to check it on the "real" data, and of course get back to report here.

  14. #14
    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,433

    Re: Auto fill columns with data

    Looked OK ...


    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    L
    M
    N
    8
    State
    City
    Neighborhood
    Plant
    State
    City
    Neighborhood
    Plant
    9
    CA
    LA
    East
    Apple
    CA
    LA
    East
    Apple
    TRUE
    TRUE
    TRUE
    TRUE
    10
    CA
    LA
    East
    Apple
    CA
    LA
    East
    Apple
    TRUE
    TRUE
    TRUE
    TRUE
    11
    CA
    LA
    West
    West
    CA
    LA
    West
    West
    TRUE
    TRUE
    TRUE
    TRUE
    12
    CA
    SF
    South
    South
    CA
    SF
    South
    South
    TRUE
    TRUE
    TRUE
    TRUE
    13
    CA
    SF
    South
    South
    CA
    SF
    South
    South
    TRUE
    TRUE
    TRUE
    TRUE
    14
    CA
    SF
    South
    South
    CA
    SF
    South
    South
    TRUE
    TRUE
    TRUE
    TRUE
    15
    CA
    SF
    South
    South
    CA
    SF
    South
    South
    TRUE
    TRUE
    TRUE
    TRUE
    16
    NY
    NY
    Manhattan
    Tom
    NY
    NY
    Manhattan
    Tom
    TRUE
    TRUE
    TRUE
    TRUE
    17
    NY
    NY
    Manhattan
    Tom
    NY
    NY
    Manhattan
    Tom
    TRUE
    TRUE
    TRUE
    TRUE
    18
    NY
    BF
    West
    West
    NY
    BF
    West
    West
    TRUE
    TRUE
    TRUE
    TRUE
    19
    NY
    BF
    West
    West
    NY
    BF
    West
    West
    TRUE
    TRUE
    TRUE
    TRUE
    20
    TX
    HU
    HU
    HU
    TX
    HU
    HU
    HU
    TRUE
    TRUE
    TRUE
    TRUE
    21
    TX
    HU
    HU
    HU
    TX
    HU
    HU
    HU
    TRUE
    TRUE
    TRUE
    TRUE
    22
    FL
    FL
    FL
    FL
    FL
    FL
    FL
    FL
    TRUE
    TRUE
    TRUE
    TRUE
    23
    FL
    FL
    FL
    FL
    FL
    FL
    FL
    FL
    TRUE
    TRUE
    TRUE
    TRUE
    24
    FL
    FL
    FL
    FL
    FL
    FL
    FL
    FL
    TRUE
    TRUE
    TRUE
    TRUE
    25
    NV
    LV
    Hotel
    Room
    NV
    LV
    Hotel
    Room
    TRUE
    TRUE
    TRUE
    TRUE
    26
    NV
    LV
    Hotel
    Room
    NV
    LV
    Hotel
    Room
    TRUE
    TRUE
    TRUE
    TRUE
    27
    NV
    RE
    AirPort
    AirPort
    NV
    RE
    AirPort
    AirPort
    TRUE
    TRUE
    TRUE
    TRUE


    Regards, TMS

  15. #15
    Forum Contributor
    Join Date
    12-30-2012
    Location
    Israel
    MS-Off Ver
    2007, 2016
    Posts
    642

    Re: Auto fill columns with data

    it works perfectly with the small chank of real data I have at home. Only tommorrow I'd be able to check it on the whole database at work. Best forum in the world!

    @TMS, please check PM.

  16. #16
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Auto fill columns with data

    Or:

    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. [SOLVED] Auto Fill formulas for some columns
    By macrofan2012 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-25-2012, 09:51 AM
  2. Auto fill in columns
    By joyeapen in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-02-2011, 04:18 AM
  3. Replies: 8
    Last Post: 12-04-2010, 01:20 PM
  4. [SOLVED] Auto fill Column based on data in other columns
    By SITCFanTN in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 06-06-2006, 04:10 PM
  5. [SOLVED] Auto fill of columns
    By linstock in forum Excel General
    Replies: 1
    Last Post: 01-03-2006, 07:25 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