+ Reply to Thread
Results 1 to 3 of 3

formula simplify

  1. #1
    Registered User
    Join Date
    05-25-2011
    Location
    Cincinnati, Ohio
    MS-Off Ver
    Excel 2007
    Posts
    2

    Talking formula simplify

    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!

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: formula simplify

    Hello hitzexcel,

    Welcome to the Forum!

    You can use this formula to sum the values for "Gas". The formula was written using column "A" and "B" where "A" is the amount and "B" is the item.
    =SUMIF(B2:B13,"=Gas",A2:A13)
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    05-25-2011
    Location
    Cincinnati, Ohio
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: formula simplify

    thanks! it works great and now i know how to use that function

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1