Sum based on multiple criteria (one of the criteria is not unique) until a threshold is reached.

phillipsdp11

New Member
Joined
Nov 8, 2016
Messages
5
Hi -

I'm trying to build an output model similar to the one shown below, please see the following explanations to help answer:

Main Issues:
(I) When a unique ID has multiple transaction with a selected product code input before meeting the selected threshold amount.
(II) Once threshold is met further reducing the total cost by the subsidy.

Please note from the sample output, unique ID example 3x3 which encounters its first transaction on 1/1/2015 with a product code of 1 for $5, because the product code is 1 only the subsidy is used to reduce the total cost of this first transaction. The second transaction occurs on 1/7/2015 with a product code of 2 for $235, because this product code is equal to our input we must first reduce this claim by the threshold amount of $300 (Note: this does not cause a negative balance instead it should be treated as the 1st step in surpassing our 1st threshold). The third transaction on 1/9/2015 with a product code of 2 for $1,363.20 should be reduced by the remaining amount of our 1 threshold balance after the prior transaction on 1/7/2015 of $65 ($300 - $235) and then further reduced by the subsidy input.

Sample Source Data Explanation:

(I) The service date represents each transaction date for each customer
(II) The Unique ID represents a particular customer
(III) The product code input, (in this example 2 but can be 1, 2, or both) indicates whether or not the 1st threshold input (in this example $300) should be deducted from the total cost when calculating net cost to me.
(IV) The total cost represents the total cost of each transaction

Other important considerations: The source data is sorted by service date and unique ID, so that each customers transactions are listed in the order in which they were incurred.

Sample Output Explanation:

* For each unique ID I need to calculate the net cost to me on each day of the year based on the inputs shown below: Explanation of Inputs:

(I) Product code- the product code can be either 1, 2, or both. In this example it is 2 and denotes when a customer transaction has a threshold amount that needs to be applied before subsidies are factored.

(II) 1st threshold- given the product code input of (1, 2, or both) the total cost of the transactions for the customer should be reduced by this amount until the total cost with the associated product code input has been exhausted. (Example: Unique ID 1x1's first transaction has product code 2 listed and a total cost of $2,944.47 (far exceeding the first threshold, however there could be multiple transactions before the threshold is met, see Unique ID 3x3 from the sample output). The $2,944.47 should be reduced by the 1st threshold amount of $300 and the remainder should be further reduced by the subsidy amount (in this example is 25%) to show a net cost to me on 1/2/2015 of $1,983.35. Further, the threshold input can be $0 to $400.

(III) Subsidy- this is the amount that should be used to reduce the total cost of each transaction. In this example when product code input equals 1 or when total cost of product code 2 has surpassed the 1st threshold the subsidy amount should be applied to reduce total cost. IMPORTANT: Subsidy can be expressed as either a percentage of total cost or as dollar value reduction of total cost.


Sample Source Data:
Service Date
Unique ID
Product Code
Total Cost
1/2/2015
1x1
2
$2,944.47
1/7/2015
1x1
1
$246.13
1/9/2015
1x1
$545.00
1/2/2015
2x2
2
$1,835.06
1/5/2015
2x2
1
$21.74
1/1/2015
3x3
1
$5.00
1/7/2015
3x3
2
$235.00
1/9/2015
3x3
2
$1,363.20
Continued
Continued
Continued
Continued
Sample Output:
Day
Inputs
Unique ID
1/1/2015
1/2/2015
1/3/2015
1/5/2015
1/6/2015
1/7/2015
1/8/2015
1/9/2015
Continue for remainder of calendar Year
Subsidy
25%
1x1
$0.00
$1,983.35
$0.00
$0.00
$0.00
$245.88
$0.00
$408.75
1st Threshold
300
2x2
$0.00
$1,151.30
$0.00
$16.31
$0.00
$0.00
$0.00
$0.00
Product Code
2
3x3
$3.75
$0.00
$0.00
$0.00
$0.00
$0.00
$0.00
$973.50

<tbody>
</tbody>
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Forum statistics

Threads
1,214,826
Messages
6,121,792
Members
449,048
Latest member
greyangel23

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