Apr 30 2024 08:57 PM
Hi,
I hope someone can assist me with a formula to apply to a large dataset. Volumes are currently both produced and sold simultaneously, with the price per hour fluctuating. The objective is to sell the volumes produced at the highest available price on the day that it gets produced. However, there is a limit to the volumes that can be sold on an hourly basis. Therefore, the formula should consider the daily volumes and aim to sell them at the highest prices available throughout the day.
May 01 2024 02:50 AM - edited May 01 2024 02:55 AM
Solution@RundertheC Here's one possibility:
=MIN(MAX(SUMIFS(volume, dates, date) - COUNTIFS(dates, date, prices, ">" & price) * 100, 0) / COUNTIFS(dates, date, prices, price), 100)
With range references, it would look like this:
=MIN(MAX(SUMIFS($D$2:$D$21, $A$2:$A$21, A2) - COUNTIFS($A$2:$A$21, A2, $C$2:$C$21, ">" & C2) * 100, 0) / COUNTIFS($A$2:$A$21, A2, $C$2:$C$21, C2), 100)
See attached sample workbook, if needed...
May 01 2024 03:38 PM
@djclements you're too good. That's perfect. Thank you!
May 01 2024 02:50 AM - edited May 01 2024 02:55 AM
Solution@RundertheC Here's one possibility:
=MIN(MAX(SUMIFS(volume, dates, date) - COUNTIFS(dates, date, prices, ">" & price) * 100, 0) / COUNTIFS(dates, date, prices, price), 100)
With range references, it would look like this:
=MIN(MAX(SUMIFS($D$2:$D$21, $A$2:$A$21, A2) - COUNTIFS($A$2:$A$21, A2, $C$2:$C$21, ">" & C2) * 100, 0) / COUNTIFS($A$2:$A$21, A2, $C$2:$C$21, C2), 100)
See attached sample workbook, if needed...