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

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
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
Service CodeRate Valid From (dd/mm/yy)Rate Valid to (dd/mm/yy)
A
A
A
B
B

<colgroup><col style="width: 25pxpx"><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]

[TD="align: right"]Rate[/TD]

[TD="align: center"]2[/TD]

[TD="align: right"]15-03-19[/TD]
[TD="align: right"]14-04-19[/TD]
[TD="align: right"]5.25[/TD]

[TD="align: center"]3[/TD]

[TD="align: right"]15-02-19[/TD]
[TD="align: right"]14-03-19[/TD]
[TD="align: right"]4.75[/TD]

[TD="align: center"]4[/TD]

[TD="align: right"]15-01-19[/TD]
[TD="align: right"]14-02-19[/TD]
[TD="align: right"]4.5[/TD]

[TD="align: center"]5[/TD]

[TD="align: right"]03-04-19[/TD]
[TD="align: right"]02-05-19[/TD]
[TD="align: right"]9.5[/TD]

[TD="align: center"]6[/TD]

[TD="align: right"]12-06-18[/TD]
[TD="align: right"]11-07-18[/TD]
[TD="align: right"]8.5[/TD]

[TD="align: center"]7[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

</tbody>
Pricelist

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH="width: 10px"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]C2[/TH]
[TD="align: left"]=EDATE(B2,1)-1[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]



ABC
Service CodeDate of Sale
A
A
A
B
B
B

<colgroup><col style="width: 25pxpx"><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]

[TD="align: right"]Cost[/TD]

[TD="align: center"]2[/TD]

[TD="align: right"]12-03-19[/TD]
[TD="align: right"]4.75[/TD]

[TD="align: center"]3[/TD]

[TD="align: right"]25-01-19[/TD]
[TD="align: right"]4.5[/TD]

[TD="align: center"]4[/TD]

[TD="align: right"]18-03-19[/TD]
[TD="align: right"]5.25[/TD]

[TD="align: center"]5[/TD]

[TD="align: right"]02-05-19[/TD]
[TD="align: right"]9.5[/TD]

[TD="align: center"]6[/TD]

[TD="align: right"]07-04-18[/TD]
[TD="align: right"]0[/TD]

[TD="align: center"]7[/TD]

[TD="align: right"]27-06-18[/TD]
[TD="align: right"]8.5[/TD]

</tbody>
Service

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH="width: 10px"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]C2[/TH]
[TD="align: left"]=SUMPRODUCT((B2>=Pricelist!$B$2:$B$6)*(B2<=Pricelist!$C$2:$C$6)*(A2=Pricelist!$A$2:$A$6)*Pricelist!$D$2:$D$6)[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]



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,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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