# Logical formula for calculating until a number has been reached

#### dicez

##### New Member
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.

 Product Volume Volume Category 1/3 Volume Apple 1 Low Apple 7,333333333 Pear 1 Pear Apple 1 Low Cherry Cherry 2 Pear 1 Cherry 3 Cherry 2 Pear 1 Apple 1 Low Apple 1 Low Pear 1 Apple 1 Low Cherry 2 Pear 1 Cherry 2 Cherry 3 Pear 2 Apple 1 Low Apple 2 Medium Pear 1 Apple 2 Medium Cherry 2 Pear 1 Cherry 3 Cherry 2 Pear 1 Apple 3 Medium Apple 3 High Pear 1 Apple 3 High Cherry 2 Pear 1 Cherry 2 Cherry 3 Pear 2 Apple 3 High

<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
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
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.

#### dicez

##### New Member
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"))

Thank you, it seems to work fine!

Replies
0
Views
227
Replies
3
Views
123
Replies
5
Views
528
Replies
1
Views
264
Replies
14
Views
1K

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.

### Which adblocker are you using?

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

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