MATCH challenge

MrPokemans

New Member
Joined
Dec 3, 2013
Messages
10
Hi,

I'm breaking my head on this one.


The data set contains:

on Worksheet 1, a table with thousands of projects:

column A: company name (not unique for each project)
column B: start date of project
column C: end date of project
...with every row being a single project

on Worksheet 2, a table with thousands of invoices:

column A: company name (not unique for each invoice)
column B: starting date of invoiced period
column C: end date of invoiced period
...with every row being a single invoice


Each project is unique and doesnt overlap with other projects of the same company. A single project can have multiple invoices corresponding to it, but each invoice applies only to a single project.

The company name must be similar to that of the invoice to be applicable for that project. Additionally, the invoiced dates must be within the period of that project.


The question is:

How to add a value to each invoice showing the row number of the project that it corresponds to.


For example:

The first row is a project from company HAPPY and has a starting date of 1-1-16 and an end date of 12-12-16.
The second is a project from company HAPPY has a starting date of 1-1-17 and an end date of 2-2-17.
The third is a project from company FAKE has a starting date of 5-5-16 and an end date of 9-9-16.

The first invoice is from company HAPPY, for the period 2-2-16 untill 4-4-16
The second invoice is from company HAPPY, for the period 5-5-16 untill 6-6-16
The third invoice is from company FAKE, for 10-10-16 untill 11-11-16.

The result should be that the first invoice corresponds to the first project (row# 1)
The second invoice also corresponds to the first project (row# 1)
The third invoice corresponds to none of the three projects (row# error)

My progress so far:

Ive tried INDEX MATCH functions in array format, but it fails to deal with multiple MATCH conditions for both starting and ending dates at the same time.

One interesting idea was to convert the company names in column A to numbers. Then I made an extra column D adding the company number to the starting date (=A1&B1) for both the projects table and the invoice table. Next I added another column E in the Invoice table to MATCH them with the projects column D. This way I can play with the MATCH criteria number of -1, 0 or 1 to match the invoice starting date as 'at least' as high as the starting date of the project. But I couldnt make the MATCH it with the end date at the same time and came to a dead end.

Unfortunately I can't share the file with you because of a lot of privacy related data. I could build a new file but that would take some time.

Can anyone help me???


Regards, Joris
 
Last edited:

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
You can only really do this if the company name is an exact match.


Book1
ABC
1Company NameProject Start DateProject End Date
2HAPPY01/01/201612/12/2016
3HAPPY01/01/201702/02/2017
4FAKE05/05/201609/09/2016
Sheet1



Book1
ABCD
1Company NameInvoice Period StartInvoiced Period EndRow
2HAPPY02/02/201604/04/20162
3HAPPY05/05/201606/06/20162
4FAKE10/10/201611/11/20160
Sheet2
Cell Formulas
RangeFormula
D2=SUMPRODUCT((Sheet1!$A$1:$A$1000=$A2)*(Sheet1!$B$1:$B$1000<=$B2)*(Sheet1!$C$1:$C$1000>=$C2)*ROW(Sheet1!$A$1:$A$1000))


WBD
 
Upvote 0

Forum statistics

Threads
1,215,480
Messages
6,125,050
Members
449,206
Latest member
Healthydogs

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top