sumif

Gusher

Board Regular
Joined
Aug 21, 2011
Messages
207
Office Version
  1. 365
Platform
  1. Windows
Bank NameGBP equivalent
Bank A36,551
Bank A646,489
Bank A2,200,000
Bank A2,088
Bank A45,092
Bank B41,644
Bank B313,002
Bank B234
Bank B40,361
Bank C11,400
Bank C5,678
Bank C789


1. I need a formula that for a specified bank name will return the number of accounts wihtin a specified account size. For example for bank B count number of accounts greater than 2000 GBP and less than 4000 GBP.

2. Then a formula that sums the value all those accounts in the size 2000 GBP - 4000 GBP.

Many Thanks

Mark
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Excel Formula:
=SUMIFS(B:B,A:A,"Bank B",B:B,">=2000",B:B,"<=4000")

Note that in the sample it will be 0. The formula sums also threshold values (2000 and 4000) if you want to exclude them, change >= and <= to > and <
 
Upvote 0
None of the record in your example meet all three criteria:
- column A is "Bank B"
- column B is between 2000 and 4000

So the total would be 0.

I created an example below that has 2 record meeting the criteria. You would use a SUMIFS function, which allows multiple conditions:

1732020498163.png


Formula in cell E3:
Excel Formula:
=SUMIFS(B3:B14,A3:A14,D3,B3:B14,">=" &D4,B3:B14,"<="&D5)
 
Upvote 0
PS. As you use Microsoft 365 you may easily prepare single formula to calculate whole dynamic list for all banks. But for sample data this list will include only one bank :-)

So test it with changed data as shown above. You may also include references to cells containing limits as shown by @Joe4 Notice that instead of ">=2000" a bit more advanced notation is used. Let's assume minimum value is in C1. You can't write just ">=C1" but have to concatenate texts >= with content of C1 cell. So use ">=" &C1

(Joe4 used D4 but in example below it could easily cause spill error).


Excel Formula:
=GROUPBY(A1:A14,B1:B14,SUM,3,0,,(B1:B14>=2000)*(B1:B14<=4000))
Zeszyt1
ABCDE
1Bank NameGBP equivalentBank NameGBP equivalent
2Bank A2088
3Bank A36551
4Bank A646489
5Bank A2200000
6Bank A2088
7Bank A45092
8Bank B41644
9Bank B313002
10Bank B234
11Bank B40361
12Bank C114
13Bank C5678
14Bank C789
Arkusz1
Cell Formulas
RangeFormula
D1:E2D1=GROUPBY(A1:A14,B1:B14,SUM,3,0,,(B1:B14>=2000)*(B1:B14<=4000))
Dynamic array formulas.
 
Last edited:
Upvote 0
I think you also wanted a count of the Banks that fit your criteria. How about this:

INCOME.xlsm
AHAIAJAK
1Bank NameGBP equivalentCountSum
2
3Bank A36,55100
4Bank A646,489
5Bank A2,200,000
6Bank A2,088
7Bank A45,092
8Bank B41,644
9Bank B313,002
10Bank B234
11Bank B40,361
12Bank C11,400
13Bank C5,678
14Bank C789
PruCalc
Cell Formulas
RangeFormula
AJ3AJ3=COUNTIFS(AH3:AH14,"Bank B",AI3:AI14,">2000",AI3:AI14,"<4000")
AK3AK3=SUMIFS(AI3:AI14,AH3:AH14,"Bank B",AI3:AI14,">2000",AI3:AI14,"<4000")
 
Upvote 0
I think that formula in AJ3 is not per se for banks counting. It will return the number of accounts for given Bank which fulfill that criteria (0, as is seen in output in case when Bank B has no such accounts).
 
Upvote 0
Indeed, I focused only on second part. But too have full list with accounts count (per bank) GroupBy would be also fine.
Excel Formula:
=GROUPBY(A1:A14,B1:B14,COUNTA,3,0,,(B1:B14>=2000)*(B1:B14<=4000))


I'm not sure how to force Groupby to use two functions at once, so my (far-from-perfect-but-working :-)) all in one formula would be:
Excel Formula:
=HSTACK(GROUPBY(A1:A14,B1:B14,COUNTA,3,0,,(B1:B14>=2000)*(B1:B14<=4000)),CHOOSECOLS(GROUPBY(A1:A14,B1:B14,SUM,3,0,,(B1:B14>=2000)*(B1:B14<=4000)),2))
 
Upvote 0
You can get the count & sum like
Fluff.xlsm
ABCDEF
1Bank NameGBP equivalent SUMCOUNT
2Bank A20881
3Bank A36,551Bank B62402
4Bank A646,489
5Bank A2,200,000
6Bank A2,088
7Bank A45,092
8Bank B3,900
9Bank B313,002
10Bank B2340
11Bank B40,361
12Bank C11,400
13Bank C5,678
14Bank C789
Data
Cell Formulas
RangeFormula
D1:F3D1=GROUPBY(A1:A100,B1:B100,HSTACK(SUM,COUNT),0,0,,(B1:B100>=2000)*(B1:B100<=4000))
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,223,929
Messages
6,175,451
Members
452,642
Latest member
acarrigan

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