How to get a percentage of multiple samples in different sized groups.

Zaner0445

New Member
Joined
Mar 6, 2021
Messages
3
Office Version
  1. 365
Platform
  1. MacOS
Example Problem_1.xlsx
ABCDEFGHIJKLMNO
1GroupsBLisotopeLabelcompoundGroupsBL
24332.1026C12 PARENT1-Methyladenosine%C12 89.10%
3247.619056C13-label-11-Methyladenosine%C13-1 5.09%
4282.373093C13-label-12-Aminoadipate%C13-2 5.81%
586606.4224C12 PARENT2-Dehydro-D-gluconate%C12 85.13%
65594.67302C13-label-12-Dehydro-D-gluconate%C13-1 5.50%
7374.129334C13-label-22-Dehydro-D-gluconate%C13-2 0.37%
8736.817081C13-label-32-Dehydro-D-gluconate%C13-3 0.72%
9286.033555C13-label-42-Dehydro-D-gluconate%C13-4 0.28%
10650.682913C13-label-52-Dehydro-D-gluconate%C13-5 0.64%
117480.36311C13-label-62-Dehydro-D-gluconate%C13-6 7.35%
12101338.69C12 PARENT2-Hydroxy-2-methylsuccinate%C12 95.02%
134671.57155C13-label-12-Hydroxy-2-methylsuccinate%C13-1 4.38%
14365.32775C13-label-22-Hydroxy-2-methylsuccinate%C13-2 0.34%
15271.325041C13-label-32-Hydroxy-2-methylsuccinate%C13-3 0.25%
16101342.959C12 PARENT2-hydroxyglutaric acid%C12 95.02%
174678.6522C13-label-12-hydroxyglutaric acid%C13-1 4.39%
18365.32775C13-label-22-hydroxyglutaric acid%C13-2 0.34%
19271.325041C13-label-32-hydroxyglutaric acid%C13-3 0.25%
2050318.3534C12 PARENT3-Phosphoglycerate%C12 97.13%
211489.11048C13-label-13-Phosphoglycerate%C13-1 2.87%
22
23For example, I am taking J2, and then dividing it by Sum(J2:J4). I am trying to figure out a formula that will know to only do it for each group. The new group starts at the green highlight.
Sheet1
Cell Formulas
RangeFormula
H2:H4H2=B2/SUM(B$2:B$4)
H5:H11H5=B5/SUM(B$5:B$11)
H12:H15H12=B12/SUM(B$12:B$15)
H16:H19H16=B16/SUM(B$16:B$19)
H20:H21H20=B20/SUM(B$20:B$21)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
G1:G21Cell Value="%C12 "textNO
G1:G21Cell Value="%C12"textNO
G1:G21Cell Value="%C12"textNO
G2:G21Cell Value="%C12"textNO
G1:G21Cell Value="%C12"textNO
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Hello,

I am trying to figure out a way to get a percent of one of these labels over the entire group. I can do it individually, but am having problems making Excel do the function for me for the large data set I have. I am taking mass % of one sample over the entire samples summed together. The problem is that each group has different amounts of samples. One group might just have two samples, while another has seven. I am attaching a picture, hopefully somebody can make sense of it.
 
Upvote 0
It seems that a "group" is the set of cells starting with a "parent" cell in column D.

It might help to add the formulas in column F, so that each group has a unique number.

Then the formulas in your column H can be replaced with the formulas in my column I.

Book1
BCDEFGHI
1BLisotopeLabelcompoundGroup#GroupsBL (orig)BL (new)
24332.102601000000C12 PARENT1-Methyladenosine1%C12 89.0995100602%89.0995100602%
3247.619056200000C13-label-11-Methyladenosine1%C13-1 5.0928471971%5.0928471971%
4282.373092900000C13-label-12-Aminoadipate1%C13-2 5.8076427428%5.8076427428%
586606.422350000000C12 PARENT2-Dehydro-D-gluconate2%C12 85.1343461827%85.1343461827%
65594.673016000000C13-label-12-Dehydro-D-gluconate2%C13-1 5.4995786271%5.4995786271%
7374.129333900000C13-label-22-Dehydro-D-gluconate2%C13-2 0.3677701418%0.3677701418%
8736.817080700000C13-label-32-Dehydro-D-gluconate2%C13-3 0.7242931727%0.7242931727%
9286.033555300000C13-label-42-Dehydro-D-gluconate2%C13-4 0.2811717544%0.2811717544%
10650.682913399999C13-label-52-Dehydro-D-gluconate2%C13-5 0.6396230545%0.6396230545%
117480.363114000000C13-label-62-Dehydro-D-gluconate2%C13-6 7.3532170668%7.3532170668%
12101338.689700000000C12 PARENT2-Hydroxy-2-methylsuccinate3%C12 95.0226179630%95.0226179630%
134671.571551000000C13-label-12-Hydroxy-2-methylsuccinate3%C13-1 4.3804094970%4.3804094970%
14365.327750400000C13-label-22-Hydroxy-2-methylsuccinate3%C13-2 0.3425582012%0.3425582012%
15271.325041200000C13-label-32-Hydroxy-2-methylsuccinate3%C13-3 0.2544143388%0.2544143388%
16101342.958900000000C12 PARENT2-hydroxyglutaric acid4%C12 95.0165089881%95.0165089881%
174678.652203000000C13-label-12-hydroxyglutaric acid4%C13-1 4.3865819976%4.3865819976%
18365.327750400000C13-label-22-hydroxyglutaric acid4%C13-2 0.3425217485%0.3425217485%
19271.325041200000C13-label-32-hydroxyglutaric acid4%C13-3 0.2543872657%0.2543872657%
2050318.353440000000C12 PARENT3-Phosphoglycerate5%C12 97.1256835165%97.1256835165%
211489.110475000000C13-label-13-Phosphoglycerate5%C13-1 2.8743164835%2.8743164835%
Sheet1
Rich (BB code):
Formulas:
F2: =IF(RIGHT(D2,6)="parent", N(F1)+1, F1)
I2: =B2 / SUMIFS($B$2:$B$21, $F$2:$F$21, F2)

Select or hover the cursor over each cell to see formulas.
 
Upvote 0
Solution
It seems that a "group" is the set of cells starting with a "parent" cell in column D.

It might help to add the formulas in column F, so that each group has a unique number.

Then the formulas in your column H can be replaced with the formulas in my column I.

Book1
BCDEFGHI
1BLisotopeLabelcompoundGroup#GroupsBL (orig)BL (new)
24332.102601000000C12 PARENT1-Methyladenosine1%C12 89.0995100602%89.0995100602%
3247.619056200000C13-label-11-Methyladenosine1%C13-1 5.0928471971%5.0928471971%
4282.373092900000C13-label-12-Aminoadipate1%C13-2 5.8076427428%5.8076427428%
586606.422350000000C12 PARENT2-Dehydro-D-gluconate2%C12 85.1343461827%85.1343461827%
65594.673016000000C13-label-12-Dehydro-D-gluconate2%C13-1 5.4995786271%5.4995786271%
7374.129333900000C13-label-22-Dehydro-D-gluconate2%C13-2 0.3677701418%0.3677701418%
8736.817080700000C13-label-32-Dehydro-D-gluconate2%C13-3 0.7242931727%0.7242931727%
9286.033555300000C13-label-42-Dehydro-D-gluconate2%C13-4 0.2811717544%0.2811717544%
10650.682913399999C13-label-52-Dehydro-D-gluconate2%C13-5 0.6396230545%0.6396230545%
117480.363114000000C13-label-62-Dehydro-D-gluconate2%C13-6 7.3532170668%7.3532170668%
12101338.689700000000C12 PARENT2-Hydroxy-2-methylsuccinate3%C12 95.0226179630%95.0226179630%
134671.571551000000C13-label-12-Hydroxy-2-methylsuccinate3%C13-1 4.3804094970%4.3804094970%
14365.327750400000C13-label-22-Hydroxy-2-methylsuccinate3%C13-2 0.3425582012%0.3425582012%
15271.325041200000C13-label-32-Hydroxy-2-methylsuccinate3%C13-3 0.2544143388%0.2544143388%
16101342.958900000000C12 PARENT2-hydroxyglutaric acid4%C12 95.0165089881%95.0165089881%
174678.652203000000C13-label-12-hydroxyglutaric acid4%C13-1 4.3865819976%4.3865819976%
18365.327750400000C13-label-22-hydroxyglutaric acid4%C13-2 0.3425217485%0.3425217485%
19271.325041200000C13-label-32-hydroxyglutaric acid4%C13-3 0.2543872657%0.2543872657%
2050318.353440000000C12 PARENT3-Phosphoglycerate5%C12 97.1256835165%97.1256835165%
211489.110475000000C13-label-13-Phosphoglycerate5%C13-1 2.8743164835%2.8743164835%
Sheet1
Rich (BB code):
Formulas:
F2: =IF(RIGHT(D2,6)="parent", N(F1)+1, F1)
I2: =B2 / SUMIFS($B$2:$B$21, $F$2:$F$21, F2)

Select or hover the cursor over each cell to see formulas.
Thank you so very much! You have no idea how much time that will save me. I have thousands of samples to process. You rock!!
 
Upvote 0

Forum statistics

Threads
1,214,950
Messages
6,122,428
Members
449,083
Latest member
Ava19

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