+ Reply to Thread
Results 1 to 9 of 9

Wanting to do SUMIF across multiple columns

  1. #1
    Registered User
    Join Date
    11-13-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    5

    Wanting to do SUMIF across multiple columns

    Hi. I have a big problem here. Here's the thing:

    I have an Excel file to keep track of my football betting scores. How the format goes is like this:

    | Competition | Match | Bet | Result | Placeholder |

    In this Placeholder column, I use a function to input "1" if the value in the Result column is negative, "2" if the value in the result column is positive.

    E.g.
    ----------
    Game A: Result = 5.5 / Placeholder = 2
    Game B: Result = -5 / Placeholder = 1

    To avoid having to scroll down, I input my data horizontally. Meaning say if I input data from row 1 column 1, 2 and I reach row 39, I continue from row 1 column 5, 6.

    E.g.
    ----------
    | Column A | Column B | Column C | Column D | Column E |
    | Game 1 | Result 1 | *blank* | Game 4 | Result 4 |
    | Game 2 | Result 2 | *blank* | Game 5 | Result 5 |
    | Game 3 | Result 3 | *blank* | Game 6 | Result 6 |

    In order to keep track of how many games I won or lost, I designated a cell to keep track of my win/loss record by using the value in the Placeholder column. If the value is 2, I take those 2s, add them together, then divide it by 2 to get my actual number of wins. If the value is 1, I take those 1s and add them together to get my total number of losses.

    E.g.
    ----------
    Placeholder
    1
    2
    1

    Total wins = 1 / Total losses = 2

    Currently, the formula I use goes like this

    Wins cell
    (SUM((SUMIF(I1:I39, "=2")) / 2)) + (SUM((SUMIF(P1:P39, "=2")) / 2)) + (SUM((SUMIF(W1:W39, "=2")) / 2))......

    Losses cell
    (SUMIF(I1:I39,"=1")) + (SUMIF(P1:P39, "=1")) + (SUMIF(W1:W39, "=1"))......

    So, as you can probably see, it's getting tedious to have to constantly update the formula of the win/loss cells whenever I scroll horizontally to start on a new set of columns. I tried modifying the SUMIF function, tried using the SUMPRODUCT function and stuff to no avail.

    So, my question is, is there any way of shortening the formula in the win/loss cells such that it can continue to add itself while minimizing the number of keystrokes I need to input for every update (like, just need to add a new *letter*1:*letter*39)? I don't wish to just select the whole worksheet because firstly, it won't be accurate since my Result column may have an exact "2" or "1", making the calculations inaccurate. Secondly, it will dramatically increase the file size and processing time every time I update something.

    Oh, and one more thing. I don't have any column header like "Competition", "Result" or what identifying any of my columns. Cause I don't want to have to make it look ugly with those headers and I don't want to have to copy them repeatedly across multiple columns.

    Sorry if I'm too long-winded.
    Last edited by Vx22B012; 11-30-2012 at 11:52 AM.

  2. #2
    Registered User
    Join Date
    11-13-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Wanting to do SUMIF across multiple columns

    Hi. Please help out.

  3. #3
    Registered User
    Join Date
    11-13-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Wanting to do SUMIF across multiple columns

    Please help

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,047

    Re: Wanting to do SUMIF across multiple columns

    To best describe or illustrate your problem you would be better off attaching a dummy workbook. The workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Registered User
    Join Date
    11-13-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Wanting to do SUMIF across multiple columns

    Hi. I have attached the file for your reference as suggested.
    Attached Files Attached Files

  6. #6
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,366

    Re: Wanting to do SUMIF across multiple columns

    How about you create a Helper column (Summary of columns I,P,W) from that summary say located at Column X do the sumif(X1:X100,"=1")
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

  7. #7
    Registered User
    Join Date
    11-13-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Wanting to do SUMIF across multiple columns

    Ehh,... I don't quite get what you mean. >_>

    Are you suggesting that I do the sumif for each column seperately? Wouldn't that mean that I'm essentially doing the same thing for cell C5 and C6, only spread out across multiple columns? Then re-combining them in C5 and C6? Wouldn't that mean more work instead of less work?

  8. #8
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,366

    Re: Wanting to do SUMIF across multiple columns

    ok was just proposing that you have a summuray of the 3 columns, if you don't want that you can use sumproduct

    =SUMPRODUCT((I2:I8=2)+(P2:P8=2)+(W2:W8=2)) -> for values of 2's
    =SUMPRODUCT((I2:I8=1)+(P2:P8=1)+(W2:W8=1)) -> for values of 1's

    regards,
    vladimir

  9. #9
    Registered User
    Join Date
    11-13-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Wanting to do SUMIF across multiple columns

    I think you've just solved my problem. Many thanks.

+ 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