# Question: How to sum with an if statement?

#### echeski1

##### New Member
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

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

#### Jonmo1

##### MrExcel MVP
Col A is the countries
Col B is the values

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

#### Brian from Maui

##### MrExcel MVP
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.

Replies
3
Views
160
Replies
14
Views
168
Replies
2
Views
160
Replies
1
Views
225
Replies
15
Views
483

1,127,888
Messages
5,627,474
Members
416,250
Latest member
darius_rebelo

### 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.

### Which adblocker are you using?

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

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