+ Reply to Thread
Results 1 to 4 of 4

Populate a Table with a Range of Data

  1. #1
    Registered User
    Join Date
    07-24-2017
    Location
    Jacksonville, Florida
    MS-Off Ver
    Office 2011 for Mac
    Posts
    2

    Populate a Table with a Range of Data

    Hi, I am new here. Thank you for taking the time to read and propose a solution.

    I have large set of data (thousands of rows) that contains a column with dates and a column with sales data. I need to set up multiple tables that show sales data from date ranges, each table centered around a specified date. So the date at the top of each table determines the sales data that goes into one cell in the table, and all of the other cells in that same table should pull sales data from the sales just before that date to the sales just after that date. For example, if the date in the table says "January 20, 2017," that table should populate with the sales data from the three sales before January 20th to the three sales after January 20th.

    I know how to use VLOOKUP to pull the sales data for January 20th, but what I don't know how to do is pull the data from (for example) three sales before that (three rows above it) down to three sales days after that date. On some dates there were no sales, so the dates are not always contiguous; which means I cannot simply do a VLOOKUP to pull in data from January 19th, since there may not have been any sales on that day.

    I also know how to use OFFSET to pull data 3 rows up from a specified cell. But I cannot find any way to combine the functions of VLOOKUP and OFFSET to look up the data for January 20th and then look 3 rows above it.

    Here is an example of what the data might look like and the table that I want to create from selected data within the data set.

    Workbook5.jpg

    So I should get a table with the Units automatically filled in with 52, 59, 62, 44, 47, 53, and 51.
    Last edited by BuyWell; 07-24-2017 at 03:57 PM.

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,152

    Re: Populate a Table with a Range of Data

    try

    =index($b$2:$b$100,match(D1,$a$2:$a$100,0))

    where d1= your date

    For sale before


    =index($b$2:$b$100,match(D1,$a$2:$a$100,0)-1)

    After

    =index($b$2:$b$100,match(D1,$a$2:$a$100,0)+1)

    then -2, -3 ,+2, +3

  3. #3
    Registered User
    Join Date
    07-24-2017
    Location
    Jacksonville, Florida
    MS-Off Ver
    Office 2011 for Mac
    Posts
    2

    Re: Populate a Table with a Range of Data

    That worked beautifully! I cannot thank you enough.

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,152

    Re: Populate a Table with a Range of Data

    You're welcome.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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: 6
    Last Post: 01-08-2016, 04:19 PM
  2. Populate table based on data in another
    By Walshy2851 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 10-12-2015, 02:07 PM
  3. Replies: 2
    Last Post: 02-12-2015, 04:50 AM
  4. [SOLVED] Formula for copying over relevant data from one table to populate another table
    By amasson in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 04-19-2013, 06:11 AM
  5. Replies: 2
    Last Post: 04-15-2013, 07:22 AM
  6. [SOLVED] Formula for copying over relevant data from one table to populate another table
    By amasson in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 02-25-2013, 12:41 PM
  7. Reference / retrieve data from a table and populate a table in a different workbook?
    By philuptuous in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-17-2012, 06:21 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