+ Reply to Thread
Results 1 to 14 of 14

removing rows & dates from a vlookup table

  1. #1
    Forum Contributor
    Join Date
    12-03-2008
    Location
    Key West, FL
    MS-Off Ver
    365 Apps for Enterprise
    Posts
    665

    removing rows & dates from a vlookup table

    This workbook has a table which is filled using Vlookup. The Vlookup formula is =IFERROR(VLOOKUP($A8,Sheet5!$A$6:$E$10000,2,FALSE),"")

    I want to remove empty rows from the table in Sheet1, but the table needs to be kept at 50 rows. (in other words I want 50 rows of data with no blank rows)

    The table in Sheet5 is filled with data written by a macro.

    Is there a solution here which does not involve tweaking the macro?

    Thanks!
    Attached Files Attached Files
    Last edited by jrtaylor; 01-30-2018 at 01:36 PM.

  2. #2
    Valued Forum Contributor than_gold's Avatar
    Join Date
    10-17-2017
    Location
    Coimbatore India
    MS-Off Ver
    Office 365
    Posts
    646

    Re: removing rows & dates from a vlookup table

    Sheet5 is not exist the attached file?!
    Regards,
    Thangavel D

    Appreciate the help? CLICK *

  3. #3
    Forum Contributor
    Join Date
    12-03-2008
    Location
    Key West, FL
    MS-Off Ver
    365 Apps for Enterprise
    Posts
    665

    Re: removing rows & dates from a vlookup table

    Sheet 5 is created by a macro, which I didn't write. Also, it doesn't show increments of minutes or hours... so you have the same timestamp on multiple rows.

    I didn't write the macro but perhaps it is matching the first or last date for any particular day.

    I've added it to the first post in this thread as v2. I am hoping for a solution which does not require a third table.

    Thanks

  4. #4
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: removing rows & dates from a vlookup table

    Just a curiosity question. How is column A populated? It probably won't affect the solution. Formulas in column A will be clobbered and replaced with the fixed value for the date. The formulas on the other columns are not touched.

    The code presented here works "after the fact." Apply it after the data is added to Sheet5 and the lookups have occurred. The Macro name is RemoveRow.
    Attached Files Attached Files
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  5. #5
    Forum Contributor
    Join Date
    12-03-2008
    Location
    Key West, FL
    MS-Off Ver
    365 Apps for Enterprise
    Posts
    665

    Re: removing rows & dates from a vlookup table

    Hi, thank you. If you're referring to column A in Sheet 1, it will always start with today()-50, then add 1 day {meaning, 1 day which has data} to create each subsequent row.

    Could your macro be incorporated to other macros in the workbook (there are several) so that each time sheet 5 changes, so will the data in sheet 1?

    And if I'm running formulas on the data in sheet 1 will those formulas continue to work after the macro has done its job? (the objective is to use those 50 columns as the dataset from which to do a number of calculations)
    Last edited by jrtaylor; 01-30-2018 at 04:59 PM.

  6. #6
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: removing rows & dates from a vlookup table

    It would be simple enough to add a macro to put the proper dates on sheet1. Would you mind if I converted Sheet 1 to an Excel table? That would solve the issue of "copying down the formulas."

  7. #7
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: removing rows & dates from a vlookup table

    Here you go. A revised RemoveRow and a MakeSheet1 that populates sheet 1. I call removerow from Makesheet1, so you only have to run MakeSheet1.
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    12-03-2008
    Location
    Key West, FL
    MS-Off Ver
    365 Apps for Enterprise
    Posts
    665

    Re: removing rows & dates from a vlookup table

    Thanks dflak. This helps. I noticed when I tried it that the table in Sheet1 I was not getting 50 days of data (I should have been more clear when describing the prob). I know very little about VBA and would like to try this myself, so... is the solution somewhere in here: (eg. do the row counting by # rows than a start date?)

    Please Login or Register  to view this content.

  9. #9
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: removing rows & dates from a vlookup table

    You want 50 days of data after removing the blanks?

  10. #10
    Forum Contributor
    Join Date
    12-03-2008
    Location
    Key West, FL
    MS-Off Ver
    365 Apps for Enterprise
    Posts
    665

    Re: removing rows & dates from a vlookup table

    Yes, that's what I need. A fixed table 50 rows deep, always filled with data, and capable of having various formulas run on it even when the data changes.

  11. #11
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: removing rows & dates from a vlookup table

    OK, however you don't have 50 days worth of data on sheet 5. Send back a modified sheet. I have an idea.

  12. #12
    Forum Contributor
    Join Date
    12-03-2008
    Location
    Key West, FL
    MS-Off Ver
    365 Apps for Enterprise
    Posts
    665

    Re: removing rows & dates from a vlookup table

    OK, I just hacked sheet 5 and created a date range which contains a bit more than 50 days.
    Attached Files Attached Files

  13. #13
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: removing rows & dates from a vlookup table

    OK, time for something completely different. The assumption is that all the data on Sheet 5 is contained within the first 1,000 rows. BTW: I "hacked in more dates to do additional testing

    I make use of a pivot table that I have on the Helper Sheet. The pivot tabled has the time stamp in Column A (which is a unique list of the time stamps). In this case there are 56 unique dates.

    The results of the pivot table are "overlaid" with a named dynamic range called Date_List = OFFSET(Helper!$A$2,COUNTA(Helper!$A:$A)-52,0,50,1). This wiki explains named dynamic ranges: http://www.utteraccess.com/wiki/Offs...Dynamic_Ranges, but basically Date_List points to the last 50 dates in the pivot table.

    Then it is a matter of copying these 50 dates into the table on sheet1. Since the pivot table contains only those dates that actually exist, there is no need to remove blank rows.

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

  14. #14
    Forum Contributor
    Join Date
    12-03-2008
    Location
    Key West, FL
    MS-Off Ver
    365 Apps for Enterprise
    Posts
    665

    Re: removing rows & dates from a vlookup table

    Thanks, that's a nifty solution. I appreciate your help!

+ 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. Replies: 12
    Last Post: 05-26-2014, 09:04 PM
  2. Help with vlookup, dates, and filling out a table.
    By ikench in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-06-2013, 11:22 AM
  3. Capturing dates in Table of contains from discountinous rows
    By kets0985 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-28-2013, 02:24 AM
  4. Vlookup return the header name of table (Table of 4 column x 55 rows)
    By sanpat in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 01-09-2013, 11:23 PM
  5. Copy a table removing all rows with #N/A
    By sriaknt1983 in forum Excel General
    Replies: 6
    Last Post: 03-04-2011, 07:10 AM
  6. Double vlookup for table array with dates
    By rkrieg in forum Excel General
    Replies: 9
    Last Post: 06-18-2009, 01:15 PM
  7. Replies: 4
    Last Post: 10-31-2005, 05:05 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