# Formula to do a sumif when the if is to the right of each number?

#### tonywatsonhelp

##### Well-known Member
Hi Everyone,
OK here goes,
I,ve got a list of 30 numbers in a row and to the right of each number is the category (A,B,C OR D)

now what I'm trying to do is add up all the numbers for each category as you see below,
if the data was in columns I'd use sumif, so I'm looking for a way to sumif when the values are next to the categories
to make it simple it starts at column A so it category in A2 value in B2 and continues along for 30 values.

﻿
 a b c d e f g h i j k l m n o p q r s Total A Total B A 5 A 3 A 2 B 5 C 4 D2 A 5 B 5 15 10

<TBODY>
</TBODY>

<TBODY>
</TBODY>
so HOPEFULLY YOU CAN SEE FROM THIS I JUST WANT TOTALS FOR EACH category BUT ITS NOT SOMETHING I CAN GET?
any help would be great

Thanks

Tony﻿
﻿

### Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

#### mikerickson

##### MrExcel MVP
Would
=SUMIF(A1:N1,"A",B1:O1)

Do what you want?

#### tonywatsonhelp

##### Well-known Member
Hi, wow,
yes that does it fine,

thanks very much

Amazing!

Replies
5
Views
28
Replies
3
Views
107
Replies
5
Views
56
Replies
13
Views
224
Replies
1
Views
60