Sum If or Count if help required

nischal4487

New Member
Joined
Nov 21, 2007
Messages
45
Hi,

I have a Column which has names to rows

Name Days
John 10
Mike 15
Mike 10
John 2
Stella 20
Stella 4
Martin 30
John 20
Mike 30

I need the result total of days as below

Name Days
John 22
Mike 55
Stella 24
Martin 30


Kindly help.
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Try the SUMIF function
BTW your result totals do not match with the totals of your example ? e.g. John is 32 not 22
 
Upvote 0
Try the SUMIF function
BTW your result totals do not match with the totals of your example ? e.g. John is 32 not 22
my bad , i wrote the total wrong and yes , John is 32. But is there a way i can get the table as desired and thanks for your prompt response.
 
Upvote 0
try
NameDaysNameDays
John10John32
Mike15Mike55
Mike10Stella24
John2Martin30
Stella20
Stella4
Martin30
John20
Mike30

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Group = Table.Group(Source, {"Name"}, {{"Days", each List.Sum([Days]), type number}})
in
    Group
 
Upvote 0
try
NameDaysNameDays
John10John32
Mike15Mike55
Mike10Stella24
John2Martin30
Stella20
Stella4
Martin30
John20
Mike30

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Group = Table.Group(Source, {"Name"}, {{"Days", each List.Sum([Days]), type number}})
in
    Group
Thank you but can i use this query in Excel? I am bit of a starter and dunce ,kindly help.
 
Upvote 0
Thank you but can i use this query in Excel?
sure, if you've XL2010 or XL2013 with Power Query add-in or higher XL with Power Query built-in
update your profile (Account details) about Excel version and OS
 
Upvote 0
XL2016 has Power Query built-in so you can use M code from post #4
anyway update your profile about Excel version and OS

grpby.png
 
Upvote 0
on your range use Ctrl+T to make it Excel Table then select any cell in this table and use From Table, in new Power Query Editor window select column Name then on Home tab click Group By
the rest in on the picture in post #8

or if it's too hard you can use SUMIF
Book1
GHIJK
3NameDaysJohn32
4John10Mike55
5Mike15Stella24
6Mike10Martin30
7John2
8Stella20
9Stella4
10Martin30
11John20
12Mike30
Sheet1
Cell Formulas
RangeFormula
K3:K6K3=SUMIF(G$4:G$12,J3:J6,H$4:H$12)

 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,443
Messages
6,124,890
Members
449,194
Latest member
JayEggleton

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