+ Reply to Thread
Results 1 to 10 of 10

Fill blank range with corresponding values..

  1. #1
    Forum Contributor
    Join Date
    06-08-2012
    Location
    Lagos, Nigeria
    MS-Off Ver
    Excel 2007, 2010, 2016
    Posts
    102

    Fill blank range with corresponding values..

    Dear experts,

    i am currently working on a report that requires that i fill up with the range before i do vlookup or any other calculation(s).

    My data is currently scattered and i would love to fill up the blank spaces with the corresponding values. See attached file.

    e.g. the value for test B under column C is on row 6 while the rows 2 - 5 are blank etc.


    Many thanks for your time!
    Attached Files Attached Files

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,879

    Re: Fill blank range with corresponding values..

    Proposition with formula:
    In say H2 array formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    and copy it down/right once calculated copy all results and paste special as values into C2


    *) confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.
    Attached Files Attached Files
    Last edited by Kaper; 07-29-2016 at 05:47 AM. Reason: added comment that it's a formula solution, while question was in VBA subforum
    Best Regards,

    Kaper

  3. #3
    Forum Contributor
    Join Date
    06-08-2012
    Location
    Lagos, Nigeria
    MS-Off Ver
    Excel 2007, 2010, 2016
    Posts
    102

    Re: Fill blank range with corresponding values..

    Thanks Kaper for your prompt response.. Please i 2 questions for you to help me with.

    How do i make the formula dynamic so that it can extend to any row (currently its at 21). My actual data is in the 15k range and it can vary on monthly basis?
    How do i include this formula in a vba code? My past experience .FormulaArray was not too pleasant and did not work?

    Any pointer will be much appreciated.

    Regards,
    Kay

  4. #4
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,879

    Re: Fill blank range with corresponding values..

    With 15k rows it will be slow or very slow, but shall work too. Once it finished and you copied the results, you can of course delete whole range with formula.

  5. #5
    Forum Contributor
    Join Date
    06-08-2012
    Location
    Lagos, Nigeria
    MS-Off Ver
    Excel 2007, 2010, 2016
    Posts
    102

    Re: Fill blank range with corresponding values..

    Hi Kaper!

    I tried that formula on a 50k data and it was extremely slooww!. I had to terminate it in order to do other things.

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

    Re: Fill blank range with corresponding values..

    Does this help?

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    06-08-2012
    Location
    Lagos, Nigeria
    MS-Off Ver
    Excel 2007, 2010, 2016
    Posts
    102

    Re: Fill blank range with corresponding values..

    Thanks John. That works as well though slow as well but not as slow as the formula one.

    However, i got an error when the code get to the tail end. See attached screen shot.

    Note: I modified the range to suit my sheet

    Error.JPG

    Many thanks

  8. #8
    Forum Contributor
    Join Date
    06-08-2012
    Location
    Lagos, Nigeria
    MS-Off Ver
    Excel 2007, 2010, 2016
    Posts
    102

    Re: Fill blank range with corresponding values..

    Hi John,

    I understood what is causing the error and so I just wrote a line to re-sort the data instead of deleting the inserted rows.

    Many thanks for your time.. Much appreciated.

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

    Re: Fill blank range with corresponding values..

    You're welcome. My mistake glad you worked it out and thanks for the feedback.

  10. #10
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,879

    Re: Fill blank range with corresponding values..

    Hm,
    somehow my post from yesterday afternoon disappeared. As my code is a bit different, I post it here anyway.
    It works the same way, I'd do it manually - sort on columns A, B and one of C,D,....
    select empty cells in column C, D, ... fill them with =cellabove formula (commited with Ctrl+Enter) copy and paste as values, do the same for next column,...

    Not tested, but may be it will be faster?
    For sure would be good idea to add
    Please Login or Register  to view this content.
    at the beginning of the code

    Please Login or Register  to view this content.
    Attached Files Attached Files

+ 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. get all non blank values and fill another table
    By vardis in forum Excel Formulas & Functions
    Replies: 26
    Last Post: 05-19-2016, 06:35 PM
  2. fill blank values / expression
    By Danielle22 in forum Access Tables & Databases
    Replies: 1
    Last Post: 03-30-2014, 07:01 AM
  3. Replies: 1
    Last Post: 04-11-2013, 01:02 PM
  4. Fill blank cell in range
    By sk8shorty01 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-01-2011, 05:42 PM
  5. How to fill blank cells with different values in a column
    By intermine in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-05-2010, 12:43 AM
  6. Macro to Fill Blank Cell with Values above.
    By floridagunner in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-20-2007, 02:51 PM
  7. Help: How do I fill a column with values if it is blank?
    By limshady411 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-14-2005, 05:45 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