if the prices keep changing, how do i add the different prices for different days is there any other way to fix this?

acarwreck

New Member
Joined
Mar 13, 2024
Messages
18
Office Version
  1. 2019
Platform
  1. Windows
PRICEPRICEDate:12345
APPLE4525QTY1246
ORANGE3035QTY11
BRICK100125QTY2
MOON150140QTY472
FERRARI25500QTY35
DAY TOTAL8451951801080695
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Your question is not at all clear. Please try to spell it out in more details and give not only sample data but the expected results and explain again in relation to that.

Also, when using XL2BB it is generally better to use Mini Sheet so we can see what columns/rows the data is in and if there are any formulas involved.
 
Upvote 0
Your question is not at all clear. Please try to spell it out in more details and give not only sample data but the expected results and explain again in relation to that.

Also, when using XL2BB it is generally better to use Mini Sheet so we can see what columns/rows the data is in and if there are any formulas involved.
REGISTER APRIL.xlsx
BCDEFGHIJK
4
5
6PRICE on 1st aprilPRICE on 2nd aprilDate:1st APRIL2ND APRIL345
7APPLE4525QTY12
8ORANGE3035QTY1
9BRICK100125QTY2
10MOON150140QTY4
11FERRARI25500QTY3
12
13DAY TOTAL845195000
14expected value on 2nd april---->1585
15
16
17
18
19
20
Sheet2
Cell Formulas
RangeFormula
F13:J13F13=SUMPRODUCT($C$7:$C$11,F7:F11)








So sorry about the unclear question, so as you can see that on 1st and 2nd April there are different prices for those items and in order to calculate the total amount of each day i have used a formula thanks to this forum, now that particular formula uses one static value for the price of those items, now what if the price of certain items changes the next day? how do i get the total amount of each day if the prices of those items are changing everyday? i hope this is enough, please feel free to ask more questions.
 
Upvote 0
What is your actual data like?
This ..
1711961689522.png

.. is different to this ..

1711961749925.png


.. and even that second image is inconsistent. Do the dates say "1st APRIL", "2ND APRIL" etc or do they just say "3", "4" etc
1711961885757.png
 
Upvote 0
Is the data manually input?
Use the worksheet_change event to trap the event e.g.
Private Sub Worksheet_Change(ByVal Target As Range)
...
If Not Intersect(Target, ws.Range("range to monitor")) Is Nothing Then
...
 
Upvote 0
What is your actual data like?
This ..
View attachment 109242
.. is different to this ..

View attachment 109243

.. and even that second image is inconsistent. Do the dates say "1st APRIL", "2ND APRIL" etc or do they just say "3", "4" etc
View attachment 109245
What is your actual data like?
This ..
View attachment 109242
.. is different to this ..

View attachment 109243

.. and even that second image is inconsistent. Do the dates say "1st APRIL", "2ND APRIL" etc or do they just say "3", "4" etc
View attachment 109245







So sorry about the unclear question, so as you can see that on 1st and 2nd April there are different prices for those items and in order to calculate the total amount of each day i have used a formula thanks to this forum, now that particular formula uses one static value for the price of those items, now what if the price of certain items changes the next day? how do i get the total amount of each day if the prices of those items are changing everyday? i hope this is enough, please feel free to ask more questions.

REGISTER APRIL.xlsx
EFGHIJKLM
11
12
13ITEMPRICEDATE :12345
14APPLE50QTY 5
15ORANGE30QTY 32
16POTATOES54QTY
17SPINACH32QTY 52
18EGGPLANT12QTY 5
19DAY TOTAL29340000
20
21
Sheet3
Cell Formulas
RangeFormula
H19:L19H19=SUMPRODUCT($F$14:$F$18,H14:H18)


This is an example of what my table initially looked like. i have selected first 5 days of the month. Now the prices of some items change on the next day sometimes how do i modify this table in such a way that i can update the prices some items everyday? maybe tomorrow the cost of apples might increase the rest might remain the same. here is an example:

REGISTER APRIL.xlsx
DEFGHIJKLMN
11
12
13ITEMPRICEUPDATED PRICEDATE :12345
14APPLE5060QTY 55
15ORANGE30QTY 3232
16POTATOES54QTY
17SPINACH32QTY 5252
18EGGPLANT12QTY 55
19DAY TOTAL2934300000
20
21
22
Sheet3
Cell Formulas
RangeFormula
I19,K19:M19I19=SUMPRODUCT($F$14:$F$18,I14:I18)
J19J19=SUMPRODUCT($G$14:$G$18,J14:J18)


the price of the apple increased while the rest remained the same. how to calculate the day total with the updated apple price and old prices of the other items?
 
Upvote 0
Is the data manually input?
Use the worksheet_change event to trap the event e.g.
Private Sub Worksheet_Change(ByVal Target As Range)
...
If Not Intersect(Target, ws.Range("range to monitor")) Is Nothing Then
...
could you elaborate this with an example if you dont mind?
 
Upvote 0
  1. With your sample in post #6, how would we know that apples increased on the 2nd of the month and not on the 3rd?
  2. If apples increased again on the 4th of the month to 65, where would the information be that the price on the 1st was 50, price on the 2nd was 60 and price on the 4th was 65?
 
Upvote 0
Yes that's one of my problems here as well. the prices keep changing sometimes it doesn't. i don't know how to store it. if you could suggest that as well, would be nice.
 
Upvote 0
if you could suggest that as well, would be nice.
Could you use something like this?

Make a table like I have in columns BA:BC. This table records the date that each item changes price and what that ne price is. This column could even be on a different worksheet.
Notice that the values in the bright blue cells in row 13 are actually dates but I have formatted them to just show the day.
The formulas in row19 look up the latest price as at the date in row 13 and multiply by the quantities in rows 14:18

24 04 02.xlsm
EFGHIJKLMAZBABBBC
1ItemDatePrice
2APPLE1/01/202450
3ORANGE1/01/202430
4POTATOES1/01/202454
5SPINACH1/01/202432
6EGGPLANT1/01/202412
7SPINACH2/01/202433
8APPLE3/01/202455
9APPLE5/01/202457
10
11
12
13ITEMDATE :12345
14APPLEQTY 5551
15ORANGEQTY 3231
16POTATOESQTY 41
17SPINACHQTY 5241
18EGGPLANTQTY 521
19DAY TOTAL2934306431275186
20
Changing price
Cell Formulas
RangeFormula
H19:L19H19=LET(BA,$BA2:$BA1000,BB,$BB2:$BB1000,SUMPRODUCT(H14:H18,VLOOKUP($E14:$E18,FILTER($BA2:$BC1000,BB=MAXIFS(BB,BB,"<="&H13,BA,BA)),3,0)))
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,333
Members
452,636
Latest member
laura12345

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