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.
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Col A is the countries
Col B is the values

=SUMIF(A1:A100,"Algeria",B1:B100)
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,214,642
Messages
6,120,700
Members
448,979
Latest member
DET4492

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