INDEX MATCH with multiple criteria - looking for all dates in month/range - please help!!

thelittleredfox

New Member
Joined
Dec 15, 2014
Messages
17
Hi,

I'm really stuck on this one. Is it possible to do the following with a single formula?

I have two sheets in my workbook, the one with the formula on is called 'summary' and the other 'raw data'.

The sheets contain data on insurance policies. Each policy has a unique number which appears in column A. Each policy should pay a commission sum each month, so there should be one line for each policy in the date range for each month. The Raw data sheet simply lists all payments on all policies, which appear in date order, see below:

A
F
G
M
Date
Client name
Policy number
Commission
20/12/2014
Sarah Webb
GS348591
£4.82

<TBODY>
</TBODY>


On the summary sheet, I have one line for each policy number (policy number appears in column A). Going across the spreadsheet, there is a column for each month.
A
F
G
H
Policy Number
August 14
September 14
October 14
L8008423
GS348591
B234955F

<TBODY>
</TBODY>









I need my formula to look on the Raw data sheet for the policy number in column A of the summary sheet, then look in the date column in the Raw data sheet for the payment that falls within the month at the top of the column in the summary sheet. Where both these criteria are true, I need it to find the relevant commission amount in column G in the Raw data sheet.

Other info:
Currently, I have got the workbook doing what I want it to by inserting a helper column in column B of the Raw data sheet which uses MONTH to calculate the month of each date in column A. I then inserted the MONTH formula into cell row 1 of the summary sheet, to give the numeric month value (e.g. 8 for August 14) of the headings in row 2. Using this formula:


{=IFERROR(INDEX('Raw data'!$M$4:$M$1500,MATCH(1,('Raw data'!$G$4:$G$1500=$A4)*('Raw data'!$B$4:$B$1500=F$1),0)),"")}

I was able to get the result I wanted. But is there a simple way? The raw data sheet has new data copied and pasted into it each month, so ideally I don't want to have to have a helper column there.

Is there some way to use MONTH as part of the criteria in the INDEX MATCH array formula? Please help, I've probably spent a couple of days trying to work this out!
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
maybe something like...

Excel 2012
ABCDEFGHIJKLM
1DateClient namePolicy numberCommission
210/10/2014Sarah WebbB234955F$4.82
312/5/2014Joe SmithGS348591$5,000.00
4
5Policy NumberAugust 14September 14October 14November 14December 14
6L8008423
7GS348591$5,000.00
8B234955F$4.82

<tbody>
</tbody>
Raw Data

Array Formulas
CellFormula
F6{=IFERROR(INDEX('Raw Data'!$M$2:$M$3,MATCH($A6,IF(MONTH('Raw Data'!$A$2:$A$3)=MONTH(F$5),'Raw Data'!$G$2:$G$3),0)),"")}

<tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>
 
Upvote 0
I would pivot the raw data and then use a getpivot formula to get the commission data you are looking for based on policy number and date:

=GETPIVOTDATA("Commission",$G$1,"Date",MONTH($F$1),"Date",YEAR($F$1),"Policy number",A2)

You will want to put the dates in the Column Labels field and group by month and year.

Where G1 is the anchor for the pivot table
F1 is the cell with the date you want to look up
A2 is the policy number.

Each time you drop a new raw data field in, update the pivot table, and refresh the formulas on your summary sheet.

To be honest, I am not sure you even need the getpivot formula. Unless Im not understanding, the pivot table will put it exactly how you need it each time. You can also get sums, averages, etc. And double clicking on a data point within the pivot table will create a new table with the exact raw data.
 
Upvote 0
Thanks, Weazel! I feel like such an idiot now!

I'd been playing around with something similar:
{=IFERROR(INDEX('Raw data'!$M$4:$M$1500,MATCH($A4,IF(MONTH('Raw data'!$A$4:$A$1500)=$F$1,'Raw data'!$G$4:$G$1500),0)),""0}<o:p></o:p>

but couldn't get the MONTH bit to work and realised my expression of it was wrong. Now it does work, that is great! It was so simple, I can't believe I couldn't do it! :biggrin:
 
Upvote 0

Forum statistics

Threads
1,215,375
Messages
6,124,587
Members
449,174
Latest member
chandan4057

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