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:
[TABLE="class: grid, width: 500"]
<TBODY>[TR]
[TD]A
[/TD]
[TD]F
[/TD]
[TD]G
[/TD]
[TD]M
[/TD]
[/TR]
[TR]
[TD]Date
[/TD]
[TD]Client name
[/TD]
[TD]Policy number
[/TD]
[TD]Commission
[/TD]
[/TR]
[TR]
[TD]20/12/2014
[/TD]
[TD]Sarah Webb
[/TD]
[TD]GS348591
[/TD]
[TD]£4.82
[/TD]
[/TR]
</TBODY>[/TABLE]
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.
[TABLE="class: grid, width: 500, align: left"]
<TBODY>[TR]
[TD]A
[/TD]
[TD]F
[/TD]
[TD]G
[/TD]
[TD]H
[/TD]
[/TR]
[TR]
[TD]Policy Number
[/TD]
[TD]August 14
[/TD]
[TD]September 14
[/TD]
[TD]October 14
[/TD]
[/TR]
[TR]
[TD]L8008423
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]GS348591
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]B234955F
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</TBODY>[/TABLE]
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!
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:
[TABLE="class: grid, width: 500"]
<TBODY>[TR]
[TD]A
[/TD]
[TD]F
[/TD]
[TD]G
[/TD]
[TD]M
[/TD]
[/TR]
[TR]
[TD]Date
[/TD]
[TD]Client name
[/TD]
[TD]Policy number
[/TD]
[TD]Commission
[/TD]
[/TR]
[TR]
[TD]20/12/2014
[/TD]
[TD]Sarah Webb
[/TD]
[TD]GS348591
[/TD]
[TD]£4.82
[/TD]
[/TR]
</TBODY>[/TABLE]
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.
[TABLE="class: grid, width: 500, align: left"]
<TBODY>[TR]
[TD]A
[/TD]
[TD]F
[/TD]
[TD]G
[/TD]
[TD]H
[/TD]
[/TR]
[TR]
[TD]Policy Number
[/TD]
[TD]August 14
[/TD]
[TD]September 14
[/TD]
[TD]October 14
[/TD]
[/TR]
[TR]
[TD]L8008423
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]GS348591
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]B234955F
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</TBODY>[/TABLE]
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!