Count Based on Total With Criteria

kumara_faith

Well-known Member
Joined
Aug 19, 2006
Messages
922
Office Version
  1. 365
Hi,

I have the following table:

NameBranchJanFebMarTotal
AlexTexas105823
Washington55818
MaryHawaii55818
Virginia105823

I am trying to summarize the data based as per the table below:

NameBranchJanFebMar
AlexTexas151016
MaryVirginia151016

This is based on the following criteria:

1) The branch name for each staff is populated based on the highest total. Example for Alex, the total for Texas is 23 and Washington is 18. Therefore all the total for Jan to Mar is placed into Texas for each month
2) The same principle applies even if there is more than two states for each staff.

Is there a way to use a formula to achieve this ?

Appreciate all the help.
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Power query could solve this fairly easily. It would take learning some new skills though.
 
Upvote 0
This is much easier if the name is in every row. So I made a helper column if that is not practical.

MrExcelPlayground7.xlsx
ABCDEFG
1NameBranchJanFebMarTotalHelper Column
2AlexTexas105823Alex
3Washington55818Alex
4MaryHawaii55818Mary
5Virginia105823Mary
6
7AlexTexas151016
8MaryVirginia151016
Sheet2
Cell Formulas
RangeFormula
F2:F5F2=SUM(C2:E2)
G2:G5G2=IF(A2="",A1,A2)
A7:A8A7=UNIQUE(G2:G5)
B7:B8B7=INDEX(FILTER(B$2:B$5,$G$2:$G$5=$A7),MATCH(MAX(FILTER(F$2:F$5,$G$2:$G$5=$A7)),FILTER(F$2:F$5,$G$2:$G$5=$A7),0))
C7:E8C7=SUM(FILTER(C$2:C$5,$G$2:$G$5=$A7))
Dynamic array formulas.
 
Upvote 0
Hi James,

Thank you for your response.

The actual list is really long so it will be challenging to add the helper column and add the names manually. Is there a way formularize this without the helper column ?
 
Upvote 0
The helper column is a formula (see below) - so it aughtn't be too difficult to put that in. I've been trying to figure a way to output an array filling in the blanks from above, but I've had no luck.
MrExcelPlayground7.xlsx
ABCDEFG
1NameBranchJanFebMarTotalHelper Column
2AlexTexas105823Alex
3Washington55818Alex
4NY1113Alex
5MaryHawaii55818Mary
6Virginia105823Mary
Sheet2
Cell Formulas
RangeFormula
F2:F6F2=SUM(C2:E2)
G2:G6G2=IF(A2="",G1,A2)
 
Upvote 0
Solution

Forum statistics

Threads
1,214,919
Messages
6,122,260
Members
449,075
Latest member
staticfluids

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