Complicated sorting and summing if

MFGdatahound

New Member
Joined
Feb 6, 2015
Messages
7
Hello geniuses,

Imagine the table below is longer with more variables. Each color is a company. Number is dollars earned. There are three different businesses: A, B, and C. I'm trying to take the full sum of each company's book of business, but classify them by the more dominant business. So if Yellow made $8, 3$ of that was through business B, but the more profitable was business A. The result would output "A" because it was the stronger business. I have no idea how to do it, and there are too many companies to filter each field.

Company
$
Business

<tbody>
</tbody>
Yellow5A
Yellow3B
Orange1C
Blue8C
Blue1B
Blue8B
Green2A
Green8B
Red2A
Red3A
Red9A
Red9B
Red5C

<tbody>
</tbody>


Appreciate any advice,
Thanks.
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Use a Pivot Table here is what your data above looks like.
<style type="text/css">
table.tableizer-table {
border: 1px solid #CCC; font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
.tableizer-table td {
padding: 4px;
margin: 3px;
border: 1px solid #ccc;
}
.tableizer-table th {
background-color: #104E8B;
color: #FFF;
font-weight: bold;
}
</style><table class="tableizer-table">
<tr class="tableizer-firstrow"><th></th><th> </th><th>Sum of $</th></tr>
<tr><td>Blue</td><td>B</td><td>9</td></tr>
<tr><td> </td><td>C</td><td>8</td></tr>
<tr><td>Green</td><td>B</td><td>8</td></tr>
<tr><td> </td><td>A</td><td>2</td></tr>
<tr><td>Orange</td><td>C</td><td>1</td></tr>
<tr><td>Red</td><td>A</td><td>14</td></tr>
<tr><td> </td><td>B</td><td>9</td></tr>
<tr><td> </td><td>C</td><td>5</td></tr>
<tr><td>Yellow</td><td>A</td><td>5</td></tr>
<tr><td> </td><td>B</td><td>3</td></tr>
<tr><td>Grand Total</td><td> </td><td>64</td></tr>
</table>
 
Upvote 0
I was including pivot tables in the term "filter". I have too many "colors" to go through each and pick out the best "letters" manually. I need some type of process to do that for me. This might not be a thing. LOL. My database was not made intuitively.
 
Upvote 0
try this, copy into E2 to G2 and down
adjust the ranges to suit


Excel 2012
ABCDEFG
1Company$BusinessCompany$Business
2Yellow5AYellow5A
3Yellow3BOrange1C
4Orange1CBlue8C
5Blue8CGreen8B
6Blue1BRed9A
7Blue8B
8Green2A
9Green8B
10Red2A
11Red3A
12Red9A
13Red9B
14Red5C
Sheet2



Excel 2012
EFG
2Yellow5A
Sheet2
Cell Formulas
RangeFormula
F2=SUMPRODUCT(LARGE(($A$2:$A$14=$E2)*($B$2:$B$14),1))
E2{=INDEX($A$2:$A$14, MATCH(0, COUNTIF($E$1:E1, $A$2:$A$14), 0))}
G2{=INDEX($C$2:$C$14,MATCH(E2&F2,$A$2:$A$14&$B$2:$B$14,0),1)}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0

Forum statistics

Threads
1,215,064
Messages
6,122,942
Members
449,094
Latest member
teemeren

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