Multiple Percent based on MATCH feature

nostradamus

Board Regular
Joined
Aug 9, 2010
Messages
143
Office Version
  1. 365
Platform
  1. Windows
Need Formula for cell E2, cell F2, and cell F3
E2 should reflect the Order (in col A) that occurs the most number of times. In case there are two Orders that are highest, then take the one with highest abundance total (in col D).
F2 should reflect the percentage of that particular order in col E2 (the formula should be independent of value being in col E2 or not).
F3 - this one is similar to F2, but I want the percentage of the top three Orders (from col A)




****** http-equiv="Content-Type" content="text/html; charset=utf-8">****** name="ProgId" content="Word.Document">****** name="Generator" content="Microsoft Word 11">****** name="Originator" content="Microsoft Word 11">
ABCDEF
1OrderFamilyGenusAbundanceDominant TaxaPercentage
2EphemeropteraBaetidaeBaetis22Ephemeroptera
3EphemeropteraBaetidaeDactylobaetis102
4ColeopteraElmidaeAncyronyx21
5TrichopteraHydrobiosidaeAtopsyche13
6EphemeropteraBaetidaeParacloeodes44
7EphemeropteraBaetidaePseudocloeon65
8
9

<tbody>
</tbody>
[/QUOTE]
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Maybe something like this?

ABCDEFG
1OrderFamilyGenusAbundanceDominant TaxaPercentage
2EphemeropteraBaetidaeBaetis22Ephemeroptera87.27%
3EphemeropteraBaetidaeDactylobaetis102Coleoptera7.87%
4ColeopteraElmidaeAncyronyx21Trichoptera4.87%
5TrichopteraHydrobiosidaeAtopsyche13
6EphemeropteraBaetidaeParacloeodes44
7EphemeropteraBaetidaePseudocloeon65

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet5

Worksheet Formulas
CellFormula
F2=SUMIF($A$2:$A$7,E2,$D$2:$D$7)/SUM(D:D)

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>

Array Formulas
CellFormula
E2{=INDEX($A$2:$A$7,MATCH(MAX(IF(COUNTIF($E$1:$E1,$A$2:$A$7)=0,COUNTIF($A$2:$A$7,$A$2:$A$7)*100000+SUMIF($A$2:$A$7,$A$2:$A$7,$D$2:$D$7))),IF(COUNTIF($E$1:$E1,$A$2:$A$7)=0,COUNTIF($A$2:$A$7,$A$2:$A$7)*100000+SUMIF($A$2:$A$7,$A$2:$A$7,$D$2:$D$7)),0))}

<thead>
</thead><tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>



Percentage is based on abundance. And I'm not sure if your F3 formula is supposed to be the sum of F2:F4, but it's easier to do this way.
 
Upvote 0
Thanks Eric, your formula works great. But I have the formula columns in a different spreadsheet (same file), and when I plug in the formula for cells E2, E3, and E4, I am getting a weird output. Cell E2 is blank, value for E2 is showing up in E3, and value for E3 is showing up in E4. (I am accounting for the spreadsheet name to be put before the proper references as below: first line is your formula, and below is how I have substituted it in my spreadsheet)

your suggestion
{=INDEX($A$2:$A$7,MATCH(MAX(IF(COUNTIF($E$1:$E1,$A$2:$A$7)=0,COUNTIF($A$2:$A$7,$A$2:$A$7)*100000+SUMIF($A$2:$A$7,$A$2:$A$7,$D$2:$D$7))),IF(COUNTIF($E$1:$E1,$A$2:$A$7)=0,COUNTIF($A$2:$A$7,$A$2:$A$7)*100000+SUMIF($A$2:$A$7,$A$2:$A$7,$D$2:$D$7)),0))}
my substitution
{=INDEX(Data!$B$2:$B$1000,MATCH(MAX(IF(COUNTIF($B$15:$B15,Data!$B$2:$B$1000)=0,COUNTIF(Data!$B$2:$B$1000,Data!$B$2:$B$1000)*100000+SUMIF(Data!$B$2:$B$1000,Data!$B$2:$B$1000,Data!$F$2:$F$1000))),IF(COUNTIF($B$15:$B15,Data!$B$2:$B$1000)=0,COUNTIF(Data!$B$2:$B$1000,Data!$B$2:$B$1000)*100000+SUMIF(Data!$B$2:$B$1000,Data!$B$2:$B$1000,Data!$F$2:$F$1000)),0))}

I'm not sure if this is because I am trying to get the formulas on a different spreadsheet. If you could check into it, it would be awesome.
 
Upvote 0
Moving the formula to another sheet is a matter of adjusting the ranges, and making sure that the ranges pointing to another sheet have the sheet name, and ranges pointing to the current sheet don't have a sheet name (or have the current sheet name). I'm a little confused as to how your sheet looks. When I try to decipher your formula, it appears you've moved some of the ranges around, and I don't know where they actually are now. Nevertheless, if your Data sheet looks like this:

ABCDE
1OrderFamilyGenusAbundance
2EphemeropteraBaetidaeBaetis22
3EphemeropteraBaetidaeDactylobaetis102
4ColeopteraElmidaeAncyronyx21
5TrichopteraHydrobiosidaeAtopsyche13
6EphemeropteraBaetidaeParacloeodes44
7EphemeropteraBaetidaePseudocloeon65

<colgroup><col style="width: 25pxpx"><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Data



Then you can put the formulas on another sheet like this:

EF
1Dominant TaxaPercentage
2Ephemeroptera87.27%
3Coleoptera7.87%
4Trichoptera4.87%

<colgroup><col style="width: 25pxpx"><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet2

Worksheet Formulas
CellFormula
F2=SUMIF(Data!$B$2:$B$1000,E2,Data!$E$2:$E$1000)/SUM(Data!E:E)

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>

Array Formulas
CellFormula
E2{=INDEX(Data!$B$2:$B$1000,MATCH(MAX(IF(COUNTIF($E$1:$E1,Data!$B$2:$B$1000)=0,COUNTIF(Data!$B$2:$B$1000,Data!$B$2:$B$1000)*100000+SUMIF(Data!$B$2:$B$1000,Data!$B$2:$B$1000,Data!$E$2:$E$1000))),IF(COUNTIF($E$1:$E1,Data!$B$2:$B$1000)=0,COUNTIF(Data!$B$2:$B$1000,Data!$B$2:$B$1000)*100000+SUMIF(Data!$B$2:$B$1000,Data!$B$2:$B$1000,Data!$E$2:$E$1000)),0))}

<thead>
</thead><tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>



Adjust the ranges as needed, just be sure they point to the right columns/sheet. Hope this helps.
 
Upvote 0

Forum statistics

Threads
1,214,826
Messages
6,121,797
Members
449,048
Latest member
greyangel23

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