+ Reply to Thread
Results 1 to 13 of 13

SumIf across columns

  1. #1
    Registered User
    Join Date
    02-18-2010
    Location
    Indianapolis, Indiana
    MS-Off Ver
    Excel 2007
    Posts
    47

    SumIf across columns

    I'm fairly new with Excel and I cannot figure out how to accomplish my task.

    I have two sets of numbers (see below)


    A................B................ C............. D............. E..............F..............G

    Unit............15 days.........30 days......Unit........15days....... 30days
    iron............ 7..................3............... pan.........6................. 2
    waffle...........2.................. 6...............cup..........2................ 9
    onion...........1...................8...............iron..........6.................17

    I need to find a formula will look for the unit specified in column A and combine corresponding values in B & F. (So if when it finds iron in E4 it will add B2 and F3)

    Hopefully I explained this well enough, if you need more information please let me know.

    Thanks in advance!
    Last edited by Lithium78; 02-18-2010 at 09:46 PM. Reason: invalid topic

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: SumIf across columns

    Lithium, thanks for changing the title.

    I don't quite understand your requirement, maybe because the layout above is not easy to grab.
    When "iron" is found in E4, you want to add B2 and F3. Can you explain why these cells? What is their connection with "iron" in E4?

    Maybe you could post a data sample in a workbook and explain in context?

  3. #3
    Registered User
    Join Date
    02-18-2010
    Location
    Indianapolis, Indiana
    MS-Off Ver
    Excel 2007
    Posts
    47

    Re: SumIf across columns

    Here is a quick example, long story shot each day I have two .txt files that I import into excel. One has our original inventory aging data the other has our adjustment inventory aging data. Both original and adjustment will have the same "type" but they do not appear on the same lines of their respective text files.

    I have all possible types listed in column A, so I need a way to look in the original type and adjustment type columns for a matching value. If a matching value is found I need to combine the 15-20 and 20+ day values in columns B & C.

    Hopefully this makes sense. If not I can try again

    I appreciate the help!
    Attached Files Attached Files

  4. #4
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: SumIf across columns

    try this

    B2 =INDEX(E:E,MATCH($A2,$D:$D,0))+INDEX(H:H,MATCH($A2,$G:$G,0))

    copy across to C2, then copy B and C down.

    hth

  5. #5
    Registered User
    Join Date
    02-18-2010
    Location
    Indianapolis, Indiana
    MS-Off Ver
    Excel 2007
    Posts
    47

    Re: SumIf across columns

    That works great when there is a matching value in both the original and adjustment category... but I get NA when there is only an original entry or only an adjustment entry.

    Anyway to get it to pull the available data to B&C instead of giving errors. See B3 & C3, has an original type entry so I would like it to return those values.

  6. #6
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: SumIf across columns

    yup.

    =IF(ISNA(MATCH($A2,$D:$D,0)),0,INDEX(E:E,MATCH($A2,$D:$D,0)))+IF(ISNA(MATCH($A2,$G:$G,0)),0,INDEX(H:H,MATCH($A2,$G:$G,0)))

  7. #7
    Registered User
    Join Date
    02-18-2010
    Location
    Indianapolis, Indiana
    MS-Off Ver
    Excel 2007
    Posts
    47

    Re: SumIf across columns

    Wow.. you swim in some deep water teylyn... I just tried that in B2 and it returned #NAME?

    Am I missing something?

  8. #8
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: SumIf across columns

    the forum software puts a space into long formulas. I should have put it in code tags.

    Please Login or Register  to view this content.
    if you look closely above, you'll see a space in the last part of the formula
    INDEX(H: H,MATCH($A2,$G:$G,0)))
    here at H: H
    that's where it bombs.

  9. #9
    Registered User
    Join Date
    02-18-2010
    Location
    Indianapolis, Indiana
    MS-Off Ver
    Excel 2007
    Posts
    47

    Re: SumIf across columns

    That did it! You just solved something in 10 minutes that I was fiddling with for 4 hours today. Words can't express how grateful I am.

  10. #10
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: SumIf across columns

    INDEX is fast and powerful.

    thanks for the rep
    Last edited by teylyn; 02-18-2010 at 11:02 PM.

  11. #11
    Registered User
    Join Date
    02-18-2010
    Location
    Indianapolis, Indiana
    MS-Off Ver
    Excel 2007
    Posts
    47

    Re: SumIf across columns

    Yes, I'm going to devote some time to studying INDEX tomorrow... everything I've learned thus far has been trial and error (and lots of google searches) but this is light years ahead of my skill level.

    Thanks again!

    I'll be around, probably won't be able to answer much though! lol

  12. #12
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: SumIf across columns

    FWIW I think you will find a SUMIF will work in this instance, eg:

    B2: =SUMIF($D$2:$G$4,$A2,E$2:H$4)
    copied across matrix B2:C5

    this works because the pattern over the 2 data tables is consistent and the criteria values are non-numeric (ie sum values and criteria values are mutually exclusive)

  13. #13
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: SumIf across columns

    You see, Lithium, the water depth is relative. We have some deep sea divers here!

    Thanks, DO, for taking this to the next level.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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