Question: How to sum with an if statement?

echeski1

New Member
Joined
Nov 6, 2009
Messages
13
I am working with a large database that includes a list of countries and a numeric value associated with each. Each Country is repeated various times throughout the data list. My goal is to sum the total values of each country and create a new list with the list of countries and a single value(total sum of all country values). Is there some kind of macro or formula I can write that could help me with this issue? Here is a simplified example of the data I am working with:
Algeria 0.005
Algeria 0.152
Algeria 3.158
Argentina 8,995.560
Argentina 145.188
Argentina 99,682.467

Out of that I want:
Algeria 3.315
Argentina 108823.215

Thanks for any and all help.
 

Some videos you may like

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
Col A is the countries
Col B is the values

=SUMIF(A1:A100,"Algeria",B1:B100)
 

Brian from Maui

MrExcel MVP
Joined
Feb 16, 2002
Messages
8,458
I am working with a large database that includes a list of countries and a numeric value associated with each. Each Country is repeated various times throughout the data list. My goal is to sum the total values of each country and create a new list with the list of countries and a single value(total sum of all country values). Is there some kind of macro or formula I can write that could help me with this issue? Here is a simplified example of the data I am working with:
Algeria 0.005
Algeria 0.152
Algeria 3.158
Argentina 8,995.560
Argentina 145.188
Argentina 99,682.467

Out of that I want:
Algeria 3.315
Argentina 108823.215

Thanks for any and all help.

Try a Pivot Table.
 

Watch MrExcel Video

Forum statistics

Threads
1,127,098
Messages
5,622,683
Members
415,920
Latest member
ExcelNoob28

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
Top