Multiple criteria sales rate

RasGhul

Well-known Member
Joined
Jul 15, 2016
Messages
797
Office Version
  1. 365
Platform
  1. Windows
Hi Excelakos,

I've started a new thread so we don't continue to hijack the previous thread with a different problem.

Here is the same solution across sheets, just change the names & ranges to what you need and test if it suits;


Book1
ABCD
1Service CodeRate Valid From (dd/mm/yy)Rate Valid to (dd/mm/yy)Rate
2A15-03-1914-04-195.25
3A15-02-1914-03-194.75
4A15-01-1914-02-194.5
5B03-04-1902-05-199.5
6B12-06-1811-07-188.5
7
Pricelist
Cell Formulas
RangeFormula
C2=EDATE(B2,1)-1



Book1
ABC
1Service CodeDate of SaleCost
2A12-03-194.75
3A25-01-194.5
4A18-03-195.25
5B02-05-199.5
6B07-04-180
7B27-06-188.5
Service
Cell Formulas
RangeFormula
C2=SUMPRODUCT((B2>=Pricelist!$B$2:$B$6)*(B2<=Pricelist!$C$2:$C$6)*(A2=Pricelist!$A$2:$A$6)*Pricelist!$D$2:$D$6)
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Hi Excelakos,

I've started a new thread so we don't continue to hijack the previous thread with a different problem.

Here is the same solution across sheets, just change the names & ranges to what you need and test if it suits;

ABCD
1Service CodeRate Valid From (dd/mm/yy)Rate Valid to (dd/mm/yy)Rate
2A15-03-1914-04-195.25
3A15-02-1914-03-194.75
4A15-01-1914-02-194.5
5B03-04-1902-05-199.5
6B12-06-1811-07-188.5
7

<colgroup><col style="width: 25pxpx"><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Pricelist

Worksheet Formulas
CellFormula
C2=EDATE(B2,1)-1

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>



ABC
1Service CodeDate of SaleCost
2A12-03-194.75
3A25-01-194.5
4A18-03-195.25
5B02-05-199.5
6B07-04-180
7B27-06-188.5

<colgroup><col style="width: 25pxpx"><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Service

Worksheet Formulas
CellFormula
C2=SUMPRODUCT((B2>=Pricelist!$B$2:$B$6)*(B2<=Pricelist!$C$2:$C$6)*(A2=Pricelist!$A$2:$A$6)*Pricelist!$D$2:$D$6)

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>



Thank you very much. I confirm that it works fine.
I even organized data into tables in different sheets and the sumproduct worked just fine.
Something additional is there any way to achieve same results if we have text in cell?

Imagine that instead of rates (numbers) in the price list we have something like notes or descriptions and so it is in text format.
 
Upvote 0
Maybe this, just change =IF(C2=0,"No Valid Rate" to =IF(C2=0,"", if you prefer a blank service codes that don't have a valid date/rate.



Book1
ABCDE
1Service CodeRate Valid From (dd/mm/yy)Rate Valid to (dd/mm/yy)RateDescription
2A15-03-1914-04-195.25Text1
3A15-02-1914-03-194.75Text2
4A15-01-1914-02-194.5Text3
5B03-04-1902-05-199.5Text4
6B12-06-1811-07-188.5Text5
Pricelist



Book1
ABCD
1Service CodeDate of SaleCostDescription
2A12-03-194.75Text2
3A25-01-194.5Text3
4A18-03-195.25Text1
5B02-05-199.5Text4
6B07-04-180No Valid Rate
7B27-06-188.5Text5
Service
Cell Formulas
RangeFormula
C2=SUMPRODUCT((B2>=Pricelist!$B$2:$B$6)*(B2<=Pricelist!$C$2:$C$6)*(A2=Pricelist!$A$2:$A$6)*Pricelist!$D$2:$D$6)
D2=IF(C2=0,"No Valid Rate",INDEX(Pricelist!$E$2:$E$6,SUMPRODUCT((B2>=Pricelist!$B$2:$B$6)*(B2<=Pricelist!$C$2:$C$6)*(A2=Pricelist!$A$2:$A$6)*(ROW(Pricelist!$A$2:$A$6)-ROW(Pricelist!$A$1))),))
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,551
Members
449,088
Latest member
davidcom

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