Hey guys,

I just started using excel this week and need a little help simplifying a formula I wrote (it may be a piece of cake, but like I said, I'm totally new to this...).

Basically, I have 2 columns of data--one with a bunch of values ($) and the other specifying the item that money was spent towards. I'm using a budget because I really need this formula to organize research data, and the formula can be tested more easily with easy numbers and labels. Heres what i've got:

Amount Item
$10.15 Food
$72.18 "Gas"
$1.50 Food
$70.55 "Gas"
$19.39 Groceries
$9.99 Other
$5.00 Laundry
$6.34 Food
$52.67 Other
$6.25 Food
$70.00 "Gas"
$350.00 Other

Basically, using the "if" "sum" and "product" functions, and the "define name" (for which i used to make "gas" a name, and that name was referenced to "gas"---literally typed gas in the reference box when defining) i came up with a formula that pulls out all the values for gas and sums them up to get $212.73.

Here's my long-form formula:

=SUM((PRODUCT(IF(I5=Gas,1,0),H5)),(PRODUCT(IF(I6=Gas,1,0),H6)),(PRODUCT(IF(I7=Gas,1,0),H7)),(PRODUCT(IF(I8=Gas,1,0),H8)),(PRODUCT(IF(I9=Gas,1,0),H9)),(PRODUCT(IF(I10=Gas,1,0),H10)),(PRODUCT(IF(I11=Gas,1,0),H11)),(PRODUCT(IF(I12=Gas,1,0),H12)),(PRODUCT(IF(I13=Gas,1,0),H13)),(PRODUCT(IF(I14=Gas,1,0),H14)),(PRODUCT(IF(I15=Gas,1,0),H15)),(PRODUCT(IF(I16=Gas,1,0),H16)),(PRODUCT(IF(I17=Gas,1,0),H17)))

Basically, it uses "if" to see if it is gas, and if so, it gives a value of 1 which it then multiplies to the cell value next to it which is the amount of money spent on gas at that time, then it sums up all the values. Values without "gas" next to it is multiplied by 0.

Like I said, im really new to excel so its probably an easy fix i cant see (using the sumif function?) but any help simplifying this so i can easily use it to sum other types of data (ex. "food") without having to go back and rename everything in the formula that would be awesome!

Thanks!