Populate Data With Criteria

kumara_faith

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

I have the following :

Book2
CDEFGHI
2Table 1Table 2
3NameBranchSalesNameBranchSales
4Staff1New York100Staff1New York100
5Staff2Texas100Staff2Texas255
6Staff2Virginia80Staff3Washinton100
7Staff2Iowa75Staff4Hawaii100
8Staff3Washinton100Staff5Texas450
9Staff4Hawaii100Staff6Iowa100
10Staff5New York100Staff7Washinton100
11Staff5Texas200Staff8Hawaii100
12Staff5Virginia150Staff9Hawaii100
13Staff6Iowa100
14Staff7Washinton100
15Staff8Hawaii100
16Staff9Hawaii100
Sheet1


In Table 1, I have the raw data. In Table 2, I am trying to summarize the sales by staff. If the branch is repeated for the same staff, the sales should be summed to the branch which has the highest sales. Example is Staff 2 which has sales in Iowa, Texas and Virginia. Since the highest sales was in Texas, all the sales will be summed in Texas. Example of the correct result is in Table 2. Is there a formula that could be used to achieve this ? Appreciate all the help.🙏
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Try this

Book1
CDEFGHI
2Table 1Table 2
3NameBranchSalesNameBranchSales
4Staff1New York100Staff1New York100
5Staff2Texas100Staff2Texas255
6Staff2Virginia80Staff3Washinton100
7Staff2Iowa75Staff4Hawaii100
8Staff3Washinton100Staff5Texas450
9Staff4Hawaii100Staff6Iowa100
10Staff5New York100Staff7Washinton100
11Staff5Texas200Staff8Hawaii100
12Staff5Virginia150Staff9Hawaii100
13Staff6Iowa100
14Staff7Washinton100
15Staff8Hawaii100
16Staff9Hawaii100
Sheet1
Cell Formulas
RangeFormula
H4:H12H4=INDEX($D$4:$D$16,MATCH(AGGREGATE(14,6,$E$4:$E$16/($C$4:$C$16=G4),1),$E$4:$E$16/($C$4:$C$16=G4),0))
I4:I12I4=SUMIF($C$4:$C$16,G4,$E$4:$E$16)
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Here is a dfferent take on it.
Mr Excel Questions4.xlsm
ABCDEFGH
1Table 1
2NameBranchSales
3Staff1New York100Staff1New York100
4Staff2Texas100Staff2Texas255
5Staff2Virginia80Staff3Washinton100
6Staff2Iowa75Staff4Hawaii100
7Staff3Washinton100Staff5Texas450
8Staff4Hawaii100Staff6Iowa100
9Staff5New York100Staff7Washinton100
10Staff5Texas200Staff8Hawaii100
11Staff5Virginia150Staff9Hawaii100
12Staff6Iowa100
13Staff7Washinton100
14Staff8Hawaii100
15Staff9Hawaii100
Sheet2
Cell Formulas
RangeFormula
E3:E11E3=UNIQUE(A3:A15)
F3:F11F3=XLOOKUP(MAX(FILTER($C$2:$C$15,$A$2:$A$15=E3)),FILTER($C$2:$C$15,$A$2:$A$15=E3),FILTER($B$2:$B$15,$A$2:$A$15=E3))
G3:G11G3=SUM(FILTER(C2:C15,A2:A15=E3))
Dynamic array formulas.
 
Upvote 0
Another option
Fluff.xlsm
ABCDEFG
1Table 1
2NameBranchSalesNameBranchSales
3Staff1New York100Staff1New York100
4Staff2Texas100Staff2Texas255
5Staff2Virginia80Staff3Washinton100
6Staff2Iowa75Staff4Hawaii100
7Staff3Washinton100Staff5Texas450
8Staff4Hawaii100Staff6Iowa100
9Staff5New York100Staff7Washinton100
10Staff5Texas200Staff8Hawaii100
11Staff5Virginia150Staff9Hawaii100
12Staff6Iowa100
13Staff7Washinton100
14Staff8Hawaii100
15Staff9Hawaii100
16
Data
Cell Formulas
RangeFormula
E3:E11E3=UNIQUE(A3:A15)
F3:F11F3=BYROW(E3#,LAMBDA(br,INDEX(SORT(FILTER(B3:C15,A3:A15=br),2,-1),1,1)))
G3:G11G3=SUMIFS(C:C,A:A,E3#)
Dynamic array formulas.
 
Upvote 0
Solution
Hi Fluff,

Thank you for the solution and I appreciate it. Have a great day ahead.🙏

Thank you to awoohaw and Phuoc for your solution.🙏
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,645
Messages
6,173,523
Members
452,520
Latest member
Pingaware

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