complicated calculation of price formula

Tripleseas

Board Regular
Joined
Jul 12, 2022
Messages
87
Office Version
  1. 2013
Platform
  1. Windows
Hello community

i'm working on worbook and i need to do some calculation like this :

depending on the price in the 3 differents rang ( Cell B3 to Cell D28 ) in comparisson the rang table , if that rang is detected i want the price in the base table to be multiplied by numbers of days in that month

I did some manual examples :
Cell D3 = 60 000 ---> it's in the rang 50 001 - 180 000 ----> result : 250 ( the price of the rang ) * 31 ( numbers of days of january )

i also seperated the rangs ! i want to the calculations of the months of rang 3 to be done based on column rang 3 and so on for the others.

hope i was clear and thank you for the help.

price formulas.xlsx
ABCDEFGHIJKLMNOP
1RANG 3Rang 1RANG 2
2Gare de péage Rang 1Rang 2 Rang 3JanvierFévrierMarsAvrilMaiJuinJuilletAoûtSeptembreOctobreNovembreDécembre
3X1120 00072 00060 0007750
4X280 00048 00040 000
5X340 00024 00020 000
6X4100 00060 00050 000
7X520 00012 00010 000
8X6100 00060 00050 000
9X710 0006 0005 000645,73
10X870 00042 00035 000Rang Price
11X920 00012 00010 0000-5 00020,83
12X1030 00018 00015 0005 001 -50 00083,33
13X115 0003 0002 50050 001 -180 000250,00
14X125 0003 0002 500
15X135 0003 0002 500
16X145 0003 0002 500
17X15180 000108 00090 000
18X1610 0006 0005 000
19X175 0003 0002 500
20X185 0003 0002 500
21X1915 0009 0007 500
22X205 0003 0002 500
23X215 0003 0002 500
24X225 0003 0002 500
25X235 0003 0002 500
26X2450 00030 00025 000
27X2545 00027 00022 500
28X268 0004 8004 000
Feuil1
Cell Formulas
RangeFormula
E3E3=250*31
E9E9=20.83*31
K12K12=100/1.2
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
What is the content in E2:P2. Is it date , name of month?
In Row1 Rang1, Range2 and Range3 are market. What does that mean?
What I mean by that is :
I want the calculation that will be put from cell E3:J28 to be based only on data of column D ( rang 3 )
I want the calculation that will be put from cell K3:M28 to be based only on data of column B ( rang 1 )
I want the calculation that will be put from cell N3:P28 to be based only on data of column C ( rang 2 )
 
Upvote 0
made a small change in you range table, simply adjust the formula for Ang 1 replace D3 with B3 for rang 1 and D3 with C3 for Rang 2
Book1
ABCDEFGHIJKLMNOPQRST
1RANG 3Rang 1RANG 2
2Gare de péage Rang 1Rang 2 Rang 3Jan-22Feb-22Mar-22Apr-22May-22Jun-22Jul-22Aug-22Sep-22Oct-22Nov-22Dec-22
3X11200007200060000775070007750750077507500775077507500775075007750MinMaxPrice
4X280000480004000025830500020.83
5X3400002400020000258350015000083.33333
6X41000006000050000258350001180000250
7X52000012000100002583
8X610000060000500002583
9X71000060005000646
10X87000042000350002583
11X92000012000100002583
12X103000018000150002583
13X11500030002500646
14X12500030002500646
15X13500030002500646
16X14500030002500646
17X15180000108000900007750
18X161000060005000646
19X17500030002500646
20X18500030002500646
21X1915000900075002583
22X20500030002500646
23X21500030002500646
24X22500030002500646
25X23500030002500646
26X245000030000250002583
27X254500027000225002583
28X26800048004000646
Sheet1
Cell Formulas
RangeFormula
F3:J3F3=SUM(INDEX($T$4:$T$6,SMALL(IF(($R$4:$R$6<=$D$3)*($S$4:$S$6>=$D$3),MATCH(ROW($T$4:$T$6),ROW($T$4:$T$6)),""),ROWS($A$1:$A$1)))*(DAY(EOMONTH(F2,0))))
K3:M3K3=SUM(INDEX($T$4:$T$6,SMALL(IF(($R$4:$R$6<=$B$3)*($S$4:$S$6>=$B$3),MATCH(ROW($T$4:$T$6),ROW($T$4:$T$6)),""),ROWS($A$1:$A$1)))*(DAY(EOMONTH(K2,0))))
N3:P3N3=SUM(INDEX($T$4:$T$6,SMALL(IF(($R$4:$R$6<=$C$3)*($S$4:$S$6>=$C$3),MATCH(ROW($T$4:$T$6),ROW($T$4:$T$6)),""),ROWS($A$1:$A$1)))*(DAY(EOMONTH(N2,0))))
T5T5=100/1.2
E3:E28E3=SUM(INDEX($T$4:$T$6,SMALL(IF(($R$4:$R$6<=$D$3)*($S$4:$S$6>=$D3),MATCH(ROW($T$4:$T$6),ROW($T$4:$T$6)),""),ROWS($A$1:$A$1)))*(DAY(EOMONTH(E2,0))))
 
Upvote 0
made a small change in you range table, simply adjust the formula for Ang 1 replace D3 with B3 for rang 1 and D3 with C3 for Rang 2
Book1
ABCDEFGHIJKLMNOPQRST
1RANG 3Rang 1RANG 2
2Gare de péage Rang 1Rang 2 Rang 3Jan-22Feb-22Mar-22Apr-22May-22Jun-22Jul-22Aug-22Sep-22Oct-22Nov-22Dec-22
3X11200007200060000775070007750750077507500775077507500775075007750MinMaxPrice
4X280000480004000025830500020.83
5X3400002400020000258350015000083.33333
6X41000006000050000258350001180000250
7X52000012000100002583
8X610000060000500002583
9X71000060005000646
10X87000042000350002583
11X92000012000100002583
12X103000018000150002583
13X11500030002500646
14X12500030002500646
15X13500030002500646
16X14500030002500646
17X15180000108000900007750
18X161000060005000646
19X17500030002500646
20X18500030002500646
21X1915000900075002583
22X20500030002500646
23X21500030002500646
24X22500030002500646
25X23500030002500646
26X245000030000250002583
27X254500027000225002583
28X26800048004000646
Sheet1
Cell Formulas
RangeFormula
F3:J3F3=SUM(INDEX($T$4:$T$6,SMALL(IF(($R$4:$R$6<=$D$3)*($S$4:$S$6>=$D$3),MATCH(ROW($T$4:$T$6),ROW($T$4:$T$6)),""),ROWS($A$1:$A$1)))*(DAY(EOMONTH(F2,0))))
K3:M3K3=SUM(INDEX($T$4:$T$6,SMALL(IF(($R$4:$R$6<=$B$3)*($S$4:$S$6>=$B$3),MATCH(ROW($T$4:$T$6),ROW($T$4:$T$6)),""),ROWS($A$1:$A$1)))*(DAY(EOMONTH(K2,0))))
N3:P3N3=SUM(INDEX($T$4:$T$6,SMALL(IF(($R$4:$R$6<=$C$3)*($S$4:$S$6>=$C$3),MATCH(ROW($T$4:$T$6),ROW($T$4:$T$6)),""),ROWS($A$1:$A$1)))*(DAY(EOMONTH(N2,0))))
T5T5=100/1.2
E3:E28E3=SUM(INDEX($T$4:$T$6,SMALL(IF(($R$4:$R$6<=$D$3)*($S$4:$S$6>=$D3),MATCH(ROW($T$4:$T$6),ROW($T$4:$T$6)),""),ROWS($A$1:$A$1)))*(DAY(EOMONTH(E2,0))))
Thank you for the response, i'm still trying to apply the formula. will get back to you when tested. many thanks
 
Upvote 0
Here is full sheet
Book1
ABCDEFGHIJKLMNOP
1123RANG 3Rang 1RANG 2
2Gare de péage Rang 1Rang 2 Rang 3Jan-22Feb-22Mar-22Apr-22May-22Jun-22Jul-22Aug-22Sep-22Oct-22Nov-22Dec-22
3X11200007200060000775070007750750077507500775077507500775075007750
4X2800004800040000258323332583250025832500775077507500258325002583
5X3400002400020000258323332583250025832500258325832500258325002583
6X41000006000050000258323332583250025832500775077507500775075007750
7X5200001200010000258323332583250025832500258325832500258325002583
8X61000006000050000258323332583250025832500775077507500775075007750
9X71000060005000646583646625646625258325832500258325002583
10X8700004200035000258323332583250025832500775077507500258325002583
11X9200001200010000258323332583250025832500258325832500258325002583
12X10300001800015000258323332583250025832500258325832500258325002583
13X11500030002500646583646625646625646646625646625646
14X12500030002500646583646625646625646646625646625646
15X13500030002500646583646625646625646646625646625646
16X14500030002500646583646625646625646646625646625646
17X1518000010800090000775070007750750077507500775077507500775075007750
18X161000060005000646583646625646625258325832500258325002583
19X17500030002500646583646625646625646646625646625646
20X18500030002500646583646625646625646646625646625646
21X191500090007500258323332583250025832500258325832500258325002583
22X20500030002500646583646625646625646646625646625646
23X21500030002500646583646625646625646646625646625646
24X22500030002500646583646625646625646646625646625646
25X23500030002500646583646625646625646646625646625646
26X24500003000025000258323332583250025832500258325832500258325002583
27X25450002700022500258323332583250025832500258325832500258325002583
28X26800048004000646583646625646625258325832500646625646
Sheet1
Cell Formulas
RangeFormula
E3E3=SUM(INDEX($T$4:$T$6,SMALL(IF(($R$4:$R$6<=$D$3)*($S$4:$S$6>=$D3),MATCH(ROW($T$4:$T$6),ROW($T$4:$T$6)),""),ROWS($A$1:$A$1)))*(DAY(EOMONTH($E$2,0))))
F3:F28F3=SUM(INDEX($T$4:$T$6,SMALL(IF(($R$4:$R$6<=$D3)*($S$4:$S$6>=$D3),MATCH(ROW($T$4:$T$6),ROW($T$4:$T$6)),""),ROWS($A$1:$A$1)))*(DAY(EOMONTH($F$2,0))))
G3:G28G3=SUM(INDEX($T$4:$T$6,SMALL(IF(($R$4:$R$6<=$D3)*($S$4:$S$6>=$D3),MATCH(ROW($T$4:$T$6),ROW($T$4:$T$6)),""),ROWS($A$1:$A$1)))*(DAY(EOMONTH($G$2,0))))
H3:H28H3=SUM(INDEX($T$4:$T$6,SMALL(IF(($R$4:$R$6<=$D3)*($S$4:$S$6>=$D3),MATCH(ROW($T$4:$T$6),ROW($T$4:$T$6)),""),ROWS($A$1:$A$1)))*(DAY(EOMONTH($H$2,0))))
I3:I28I3=SUM(INDEX($T$4:$T$6,SMALL(IF(($R$4:$R$6<=$D3)*($S$4:$S$6>=$D3),MATCH(ROW($T$4:$T$6),ROW($T$4:$T$6)),""),ROWS($A$1:$A$1)))*(DAY(EOMONTH($I$2,0))))
J3:J28J3=SUM(INDEX($T$4:$T$6,SMALL(IF(($R$4:$R$6<=$D3)*($S$4:$S$6>=$D3),MATCH(ROW($T$4:$T$6),ROW($T$4:$T$6)),""),ROWS($A$1:$A$1)))*(DAY(EOMONTH($J$2,0))))
K3:K28K3=SUM(INDEX($T$4:$T$6,SMALL(IF(($R$4:$R$6<=$B3)*($S$4:$S$6>=$B3),MATCH(ROW($T$4:$T$6),ROW($T$4:$T$6)),""),ROWS($A$1:$A$1)))*(DAY(EOMONTH($K$2,0))))
L3:L28L3=SUM(INDEX($T$4:$T$6,SMALL(IF(($R$4:$R$6<=$B3)*($S$4:$S$6>=$B3),MATCH(ROW($T$4:$T$6),ROW($T$4:$T$6)),""),ROWS($A$1:$A$1)))*(DAY(EOMONTH($L$2,0))))
M3:M28M3=SUM(INDEX($T$4:$T$6,SMALL(IF(($R$4:$R$6<=$B3)*($S$4:$S$6>=$B3),MATCH(ROW($T$4:$T$6),ROW($T$4:$T$6)),""),ROWS($A$1:$A$1)))*(DAY(EOMONTH($M$2,0))))
N3:N28N3=SUM(INDEX($T$4:$T$6,SMALL(IF(($R$4:$R$6<=$C3)*($S$4:$S$6>=$C3),MATCH(ROW($T$4:$T$6),ROW($T$4:$T$6)),""),ROWS($A$1:$A$1)))*(DAY(EOMONTH($N$2,0))))
O3:O28O3=SUM(INDEX($T$4:$T$6,SMALL(IF(($R$4:$R$6<=$C3)*($S$4:$S$6>=$C3),MATCH(ROW($T$4:$T$6),ROW($T$4:$T$6)),""),ROWS($A$1:$A$1)))*(DAY(EOMONTH($O$2,0))))
P3:P28P3=SUM(INDEX($T$4:$T$6,SMALL(IF(($R$4:$R$6<=$C3)*($S$4:$S$6>=$C3),MATCH(ROW($T$4:$T$6),ROW($T$4:$T$6)),""),ROWS($A$1:$A$1)))*(DAY(EOMONTH($P$2,0))))
E4:E28E4=SUM(INDEX($T$4:$T$6,SMALL(IF(($R$4:$R$6<=$D$3)*($S$4:$S$6>=$D4),MATCH(ROW($T$4:$T$6),ROW($T$4:$T$6)),""),ROWS($A$1:$A$1)))*(DAY(EOMONTH(E3,0))))
 
Upvote 0
Here is full sheet
Book1
ABCDEFGHIJKLMNOP
1123RANG 3Rang 1RANG 2
2Gare de péage Rang 1Rang 2 Rang 3Jan-22Feb-22Mar-22Apr-22May-22Jun-22Jul-22Aug-22Sep-22Oct-22Nov-22Dec-22
3X11200007200060000775070007750750077507500775077507500775075007750
4X2800004800040000258323332583250025832500775077507500258325002583
5X3400002400020000258323332583250025832500258325832500258325002583
6X41000006000050000258323332583250025832500775077507500775075007750
7X5200001200010000258323332583250025832500258325832500258325002583
8X61000006000050000258323332583250025832500775077507500775075007750
9X71000060005000646583646625646625258325832500258325002583
10X8700004200035000258323332583250025832500775077507500258325002583
11X9200001200010000258323332583250025832500258325832500258325002583
12X10300001800015000258323332583250025832500258325832500258325002583
13X11500030002500646583646625646625646646625646625646
14X12500030002500646583646625646625646646625646625646
15X13500030002500646583646625646625646646625646625646
16X14500030002500646583646625646625646646625646625646
17X1518000010800090000775070007750750077507500775077507500775075007750
18X161000060005000646583646625646625258325832500258325002583
19X17500030002500646583646625646625646646625646625646
20X18500030002500646583646625646625646646625646625646
21X191500090007500258323332583250025832500258325832500258325002583
22X20500030002500646583646625646625646646625646625646
23X21500030002500646583646625646625646646625646625646
24X22500030002500646583646625646625646646625646625646
25X23500030002500646583646625646625646646625646625646
26X24500003000025000258323332583250025832500258325832500258325002583
27X25450002700022500258323332583250025832500258325832500258325002583
28X26800048004000646583646625646625258325832500646625646
Sheet1
Cell Formulas
RangeFormula
E3E3=SUM(INDEX($T$4:$T$6,SMALL(IF(($R$4:$R$6<=$D$3)*($S$4:$S$6>=$D3),MATCH(ROW($T$4:$T$6),ROW($T$4:$T$6)),""),ROWS($A$1:$A$1)))*(DAY(EOMONTH($E$2,0))))
F3:F28F3=SUM(INDEX($T$4:$T$6,SMALL(IF(($R$4:$R$6<=$D3)*($S$4:$S$6>=$D3),MATCH(ROW($T$4:$T$6),ROW($T$4:$T$6)),""),ROWS($A$1:$A$1)))*(DAY(EOMONTH($F$2,0))))
G3:G28G3=SUM(INDEX($T$4:$T$6,SMALL(IF(($R$4:$R$6<=$D3)*($S$4:$S$6>=$D3),MATCH(ROW($T$4:$T$6),ROW($T$4:$T$6)),""),ROWS($A$1:$A$1)))*(DAY(EOMONTH($G$2,0))))
H3:H28H3=SUM(INDEX($T$4:$T$6,SMALL(IF(($R$4:$R$6<=$D3)*($S$4:$S$6>=$D3),MATCH(ROW($T$4:$T$6),ROW($T$4:$T$6)),""),ROWS($A$1:$A$1)))*(DAY(EOMONTH($H$2,0))))
I3:I28I3=SUM(INDEX($T$4:$T$6,SMALL(IF(($R$4:$R$6<=$D3)*($S$4:$S$6>=$D3),MATCH(ROW($T$4:$T$6),ROW($T$4:$T$6)),""),ROWS($A$1:$A$1)))*(DAY(EOMONTH($I$2,0))))
J3:J28J3=SUM(INDEX($T$4:$T$6,SMALL(IF(($R$4:$R$6<=$D3)*($S$4:$S$6>=$D3),MATCH(ROW($T$4:$T$6),ROW($T$4:$T$6)),""),ROWS($A$1:$A$1)))*(DAY(EOMONTH($J$2,0))))
K3:K28K3=SUM(INDEX($T$4:$T$6,SMALL(IF(($R$4:$R$6<=$B3)*($S$4:$S$6>=$B3),MATCH(ROW($T$4:$T$6),ROW($T$4:$T$6)),""),ROWS($A$1:$A$1)))*(DAY(EOMONTH($K$2,0))))
L3:L28L3=SUM(INDEX($T$4:$T$6,SMALL(IF(($R$4:$R$6<=$B3)*($S$4:$S$6>=$B3),MATCH(ROW($T$4:$T$6),ROW($T$4:$T$6)),""),ROWS($A$1:$A$1)))*(DAY(EOMONTH($L$2,0))))
M3:M28M3=SUM(INDEX($T$4:$T$6,SMALL(IF(($R$4:$R$6<=$B3)*($S$4:$S$6>=$B3),MATCH(ROW($T$4:$T$6),ROW($T$4:$T$6)),""),ROWS($A$1:$A$1)))*(DAY(EOMONTH($M$2,0))))
N3:N28N3=SUM(INDEX($T$4:$T$6,SMALL(IF(($R$4:$R$6<=$C3)*($S$4:$S$6>=$C3),MATCH(ROW($T$4:$T$6),ROW($T$4:$T$6)),""),ROWS($A$1:$A$1)))*(DAY(EOMONTH($N$2,0))))
O3:O28O3=SUM(INDEX($T$4:$T$6,SMALL(IF(($R$4:$R$6<=$C3)*($S$4:$S$6>=$C3),MATCH(ROW($T$4:$T$6),ROW($T$4:$T$6)),""),ROWS($A$1:$A$1)))*(DAY(EOMONTH($O$2,0))))
P3:P28P3=SUM(INDEX($T$4:$T$6,SMALL(IF(($R$4:$R$6<=$C3)*($S$4:$S$6>=$C3),MATCH(ROW($T$4:$T$6),ROW($T$4:$T$6)),""),ROWS($A$1:$A$1)))*(DAY(EOMONTH($P$2,0))))
E4:E28E4=SUM(INDEX($T$4:$T$6,SMALL(IF(($R$4:$R$6<=$D$3)*($S$4:$S$6>=$D4),MATCH(ROW($T$4:$T$6),ROW($T$4:$T$6)),""),ROWS($A$1:$A$1)))*(DAY(EOMONTH(E3,0))))

Thank you for the help its deeply appreciated. I tried to apply the formula on my own workbook but couldn't get it done. i think i'm still missing something here is the error :
I will try to figure it out :)

Business Plan - Versements de l'animation Commerciale WafaCash - Copie.xlsx
ABCDEFGHIJKLMNOPQRSTUV
1Prestataire RANG1rang 2RANG 3janv-22févr-22mars-22avr-22mai-22juin-22juil-22août-22sept-22oct-22nov-22déc-22
2X1X1120 00072 00060 000#VALEUR!
3X2X280 00048 00040 000
4X3X340 00024 00020 000MinMaxPrice
5X4X4100 00060 00050 0000500020
6X5X520 00012 00010 00050015000083,33
7X6X6100 00060 00050 00050001180000250
8X7X710 0006 0005 000
9X8X870 00042 00035 000
10X9X920 00012 00010 000
11X10X1030 00018 00015 000
12X11X115 0003 0002 500
13X12X125 0003 0002 500
14X13X135 0003 0002 500
15X14X145 0003 0002 500
16X15X15180 000108 00090 000
17X16X1610 0006 0005 000
18X17X175 0003 0002 500
19X18X185 0003 0002 500
20X19X1915 0009 0007 500
21X20X205 0003 0002 500
22X21X215 0003 0002 500
23X22X225 0003 0002 500
24X23X235 0003 0002 500
25X24X2450 00030 00025 000
26X25X2545 00027 00022 500
27X26X268 0004 8004 000
28948 000568 800474 000
BP
Cell Formulas
RangeFormula
F2F2=SUM(INDEX($V$5:$V$7,SMALL(IF(($T$5:$T$7<=$E$2)*($U$5:$U$7>=$E2),MATCH(ROW($V$5:$V$7),ROW($V$5:$V$7)),""),ROWS($A$1:$A$1)))*(DAY(EOMONTH(F1,0))))
V6V6=100/1.2
C28:E28C28=SUM(C2:C27)
 
Upvote 0
You need to confirm the formula with Ctrl Shift Enter, rather than just Enter.
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

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