Logical formula for calculating until a number has been reached

dicez

New Member
Joined
Oct 16, 2019
Messages
2
Hi Guys,

I would like help with creating a measure for the following data.
I would like to categorize the products as i did manually for Apples - I calculated the total volume for the product and divided it by 3. Then I would like to start summing from the lowest volume of Apples to the highest and group them in a category such that 1/3 of the total volume is Low, 1/3 - Medium and 1/3 High.


ProductVolumeVolume Category1/3 Volume
Apple1LowApple7,333333333
Pear1Pear
Apple1LowCherry
Cherry2
Pear1
Cherry3
Cherry2
Pear1
Apple1Low
Apple1Low
Pear1
Apple1Low
Cherry2
Pear1
Cherry2
Cherry3
Pear2
Apple1Low
Apple2Medium
Pear1
Apple2Medium
Cherry2
Pear1
Cherry3
Cherry2
Pear1
Apple3Medium
Apple3High
Pear1
Apple3High
Cherry2
Pear1
Cherry2
Cherry3
Pear2
Apple3High

<colgroup><col span="2"><col><col span="2"><col></colgroup><tbody>
</tbody>
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Special-K99

Well-known Member
Joined
Nov 7, 2006
Messages
8,350
Try

in C2
=IF(SUMIFS(B$2:B2,A$2:A2,A2)>VLOOKUP(A2,E$2:F$4,2,0)*2,"High",IF(SUMIFS(B$2:B2,A$2:A2,A2)>VLOOKUP(A2,E$2:F$4,2,0),"Medium","Low"))
 

jmacleary

Well-known Member
Joined
Oct 5, 2015
Messages
1,056
Office Version
  1. 365
  2. 2007
Platform
  1. Windows
Hi there. I'm sure there will be other solutions, but try this.

I assume your data starts in A1, and that the name and 1/3 volume are in columns D and E - if not just adjust as necessary.
In E2 put: =SUMIF(A:A,D2,B:B)/3 and copy down. This will produce the 1/3 values.
In C2 put: =CHOOSE(INT(SUMIF(A$1:A2,A2,B$1:B2)/VLOOKUP(A2,D:E,2,FALSE))+1,"Low","Medium","High","High") and copy down.

This does a running total of the volumes and changes depending on whether the 1/3 or 2/3 threshold is exceeded.
 

Watch MrExcel Video

Forum statistics

Threads
1,129,317
Messages
5,635,527
Members
416,862
Latest member
MGDlite

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
Top