# Combining two variables part of SUMIF

#### Tima

##### New Member
Hello,

I have the following dataset:

Col A ---------Col B

EPAIM---------4
NAAIM---------2
EPAIM---------3
JNAIM---------2

----- = were used for example only

I can do a simple SUMIF to add up all the EPAIM, which is two. However, I would like to do a formula that would add up EPAIM, then add up certain criteria in cell B. For example, i want to add up all the EPAIM in column A, then add up only variables that have 4. So it would return there are two EPAIM and if I asked for which ones had 4 result, it would come back with 1 as an answer. So I need to have two results for EPAIM and 4, which would be two (EPAIM) and one item that has a variable of four.

### Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Hi
Welcome to the board

Remark: you should always post your excel version. I'll assume it's xl2010.

I cannot understand your post, so I'll do a bit of guessing.

I can do a simple SUMIF to add up all the EPAIM, which is two.

???

If you add the values corresponding to EPAIM you get 4+3=7, not 2

Mybe you mean you want to count how many EPAIM entries there are using COUNTIF (and not SUMIF)? In that case you'd get the value 2, as you posted.

If that's the case then

- to get how many EPAIM entries there are:

=COUNTIF(A1:A4,"EPAIM")

- to get how many EPAIM entries there are, for which the corresponding value in column B is 4:

=COUNTIFS(A1:A4,"EPAIM",B1:B4,4)

Is this what you want?

Replies
2
Views
140
Replies
9
Views
459
Replies
2
Views
170
Replies
1
Views
179
Replies
8
Views
224

1,211,452
Messages
6,101,937
Members
447,764
Latest member
gopalgriffith

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