Hello,
(Note: I have now amended the post and file).
Thanks in advance for your help and to all the contributors here.
I’ve been trying for weeks to get the following to work but have finally given up the ghost and am asking (begging) for help.
Here is the file: filev2.xlsx
I have raw data sent to me in a fixed excel format every day (C1:F53) in the attached sheet although the number of rows can vary and number of towns can vary. Columns stays fixed at 4 (C:F). I need to figure out a way for excel to use a flexible table_array to lookup certain dates within that table and return a count into 2 tables (H1:J86) & (L1:N86).
The raw data (C1:C53) in this example whilst always 4 columns in width, number of rows can vary depending on how many dates & towns are in the raw data on a given day.
I have tried to do a lookup but I cannot get the table_array to change dynamically according to how many rows the raw data has for that particular town.
The lookup is also very difficult as there are gaps between the rows.
So what I would like excel to do to populate Table 1 (H1:J86):
a) lookup the code BFSI04 (for example) in cell I1 and match it to Belfast in the mapping table (A4:B34).
b) Then go to the raw data table (C1:C53) and do a count of the "Out Date:" for Belfast and return the count into Table 1 next to the relevant date. The count for each date is in the fourth column in the raw data, "Out Count". So for example the first date in the Belfast raw data is 16/01/2015. The count in "Out count" is 1. So it returns 1. I have populated the table (H1:J86) as I would like it to be after all calculations are done. I have highlighted the cells red for the "Out Dates" as they appear in column C, but also appear in Column D as the first date of pairs.
So what I would like excel to do to populate Table 2 (L1:N86):
a) As above, lookup the code BFSI04 (for example) in cell M1 and match it to Belfast in the mapping table (A4:B34).
b) however this time I need a sum of "In Dates:". The "In Date" in column D I have highlighted in yellow. It will always be below an "Out Date:", highlighted in red as that was when the product went out. In is when it came back. So for example for Belfast 2 products came back on the 26/01/15, so cell M19 in Table 2 has 2. Unfortunately whilst Column F is populated by the report with the count for "Out Date:" the raw data report does not populate a count for the "In Date:" although the "In date" (red) is always going to be below the "Out Date" (yellow) if that helps.
I apologise if this appears complicated. Even pointing me in the right direction would be a big help. Is something like this possible using formula or does it need to be VBA based as the lookup table_array needs to change its height everyday. I have tried everything but I am at a loss.
Thank you so much!
Bookmarks