Sumifs using unique and filter functions

Tarek78

New Member
Joined
Feb 21, 2021
Messages
46
Office Version
  1. 365
Platform
  1. Windows
Hi Everyone,

I have attached a spreadsheet and highlighted in yellow the column K I would need to be filled with a formula (spill formula only so that it is completely automated).

Column I and J: This is a spill formula using Unique, Filter and Choose function.
Column K: I would need a spill formula to get the sum of the sales generated by each rep for each region covered


I tried a lot to work on it but cannot find an answer :(

Thanks for your help
 

Attachments

  • unique sumif.PNG
    unique sumif.PNG
    66.6 KB · Views: 387

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Hi there,

That's a hard one which I don't know if it's even possible.
But I've another solution which can work just fine in automation.

Excel Formula:
=IF(I6="";"";SUM(UNIQUE(FILTER(C:C;A:A&B:B=I6&J6))))

If you pull the formulla down 4 rows u should be good.
It will always have the same lengt as your spill range.

Hope it helps, GL
1654274104281.png

1654274145356.png
 
Upvote 0
Consider:

Book1
ABCDEFGHIJKLM
1Sales RepRegionSalesSales Rep
2SimonEast1000Simon
3SimonWest2000
4SimonNorth1000RepRegionSalesSales
5TimSouth4000SimonEast10001000
6TimEast5000SimonWest20002000
7TimWest1000SimonNorth10001000
8NickSouth4000
9NickWest1000
Sheet5
Cell Formulas
RangeFormula
I5:K7I5=UNIQUE(FILTER(CHOOSE({1,2,3},Table1_2[Sales Rep],Table1_2[Region],SUMIFS(Table1_2[Sales],Table1_2[Sales Rep],I2,Table1_2[Region],Table1_2[Region])),Table1_2[Sales Rep]=I2))
M5:M7M5=SUMIFS(Table1_2[Sales],Table1_2[Sales Rep],INDEX(I5#,0,1),Table1_2[Region],INDEX(I5#,0,2))
Dynamic array formulas.


You can include the sales totals in your original formula if you want (I5), or if you want a separate formula, the M5 formula will work for you.
 
Upvote 0
Consider:

Book1
ABCDEFGHIJKLM
1Sales RepRegionSalesSales Rep
2SimonEast1000Simon
3SimonWest2000
4SimonNorth1000RepRegionSalesSales
5TimSouth4000SimonEast10001000
6TimEast5000SimonWest20002000
7TimWest1000SimonNorth10001000
8NickSouth4000
9NickWest1000
Sheet5
Cell Formulas
RangeFormula
I5:K7I5=UNIQUE(FILTER(CHOOSE({1,2,3},Table1_2[Sales Rep],Table1_2[Region],SUMIFS(Table1_2[Sales],Table1_2[Sales Rep],I2,Table1_2[Region],Table1_2[Region])),Table1_2[Sales Rep]=I2))
M5:M7M5=SUMIFS(Table1_2[Sales],Table1_2[Sales Rep],INDEX(I5#,0,1),Table1_2[Region],INDEX(I5#,0,2))
Dynamic array formulas.


You can include the sales totals in your original formula if you want (I5), or if you want a separate formula, the M5 formula will work for you.
Thanks for your help . I will try it and let you know if it works. The reason I am creating this is that, ultimately, I want to sort the result by the biggest salesman (Regardless of the region). Would you formula allow me to do that afterwards ?
 
Upvote 0
Sure, a variation of that formula would work:

Book1
ABCDEF
1Sales RepRegionSales
2SimonEast1000
3SimonWest2000
4SimonNorth1000RepTotal Sales
5TimSouth4000Tim10000
6TimEast5000Nick5000
7TimWest1000Simon4000
8NickSouth4000
9NickWest1000
Sheet5
Cell Formulas
RangeFormula
E5:F7E5=LET(r,UNIQUE(Table1_2[Sales Rep]),SORT(CHOOSE({1,2},r,SUMIFS(Table1_2[Sales],Table1_2[Sales Rep],r)),2,-1))
Dynamic array formulas.
 
Upvote 0
Hi there,

That's a hard one which I don't know if it's even possible.
But I've another solution which can work just fine in automation.

Excel Formula:
=IF(I6="";"";SUM(UNIQUE(FILTER(C:C;A:A&B:B=I6&J6))))

If you pull the formulla down 4 rows u should be good.
It will always have the same lengt as your spill range.

Hope it helps, GL
View attachment 66243
View attachment 66244
Thanks I will try it and let you know
 
Upvote 0
Hi Everyone,

First of all, I would like to thank you all for helping. It is much appreciated.
I couldn't find an answer to my reply but I think my description wasn't clear enough so I will try explain it better this time.

I have attached a picture as I don't know how to install the XL2BB add-in.


We have the raw data in the table (column B to E).

I want a dynamic array formula (unique, filter, choose etc.) that gives me 4 columns :

- Column 1= IRIS CODE which is the account
- Column 2= Commercial contract which can be a sum of various project code
- Column 3= Project Code
- Column 4= Sales generated


I want the formula to sort this result ideally in this order (as specified in the yellow section):

1- the account generating the most sales
2- the commercial contract generating the most sales
3- the project generating the most sales


I don't if it is possible to perfom 3 sorts but if it is not, let me know


Thanks again so much for your help
 

Attachments

  • Dynamic array function.png
    Dynamic array function.png
    81.1 KB · Views: 51
Upvote 0
Hi Everyone,

I was wondering if someone found a solution?
 
Upvote 0
Any reason you don't just use a pivot table ?

20220605 Filter Unique Sort or Pivot Tarek78.xlsx
ABCDEFGHIJ
1IRIS CODEProjectCommercial ContractSalesIRIS CODECommercial ContractProject Sales
2ACCOFR.1001TARS1000SNCFMISTRALFR.040025000
3ACCOFR.1002Not Assigned500SNCFNot AssignedFR.11113000
4ACCOFR.1001TARS2000RATPRAEFR.112220000
5ACCOFR.1003FRI4000ACCOFRIFR.10034000
6SNCFFR.0400MISTRAL10000ACCOTARSFR.10013000
7SNCFFR.0400MISTRAL15000ACCONot AssignedFR.1002500
8SNCFFR.1111Not Assigned3000
9RATPFR.1122RAE20000
Data
 
Upvote 0
Yes, because I want to format it the way I want with additional info not from the initial raw data
 
Upvote 0

Forum statistics

Threads
1,223,895
Messages
6,175,257
Members
452,625
Latest member
saadat28

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