+ Reply to Thread
Results 1 to 15 of 15

Sum values in column A ONLY IF the value of the neighbouring column B is a certain value

  1. #1
    Registered User
    Join Date
    08-03-2016
    Location
    England
    MS-Off Ver
    Office 2016
    Posts
    5

    Sum values in column A ONLY IF the value of the neighbouring column B is a certain value

    Hi folks,

    I'm very inexperienced with Excel and have hit a bit of a wall with some calculations;

    Column A contains £numbers and Column B contains a letter (either Y or N)

    I want to be able to sum the contents of Column A only if the letter in column B is an N. I have looked at SUMIF, nested IF statements and just SUM so far but nothing appears to be working. The closest I have got so far is with this;

    =SUMIF(A1:A20, B1:B20, "N")

    This returns a value of 0 (all the other attempts just give me #VALUE) but shouldn't as every cell has a number greater than 0. I'm not sure if it's relevant but I will mention it anyway, the numbers in Column A are the result of another formula/expression, specifically ='Accounts'!F4 for example. Could you possibly shed some light on where I could be going wrong?

    Thank you,
    Adam

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Sum values in column A ONLY IF the value of the neighbouring column B is a certain val

    =SUMIF(B:B,"N",A:A) will do it. the syntax of sumif is (criteria range, criteria, sum range)
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  3. #3
    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,048

    Re: Sum values in column A ONLY IF the value of the neighbouring column B is a certain val

    Just to add in - if a formula references another formula, it generally takes teh displayed result, not the actual cell contents (the formula IN the cell)
    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

  4. #4
    Registered User
    Join Date
    08-03-2016
    Location
    England
    MS-Off Ver
    Office 2016
    Posts
    5

    Re: Sum values in column A ONLY IF the value of the neighbouring column B is a certain val

    Hi Glenn,

    Many thanks for such a quick response. Unfortunately the issue doesn't seem to have been resolved. I have amended the structure of the formula as requested but it still returns a value of 0. Can text format settings interfere with a formula? The column I want SUM'ed is set as Currency? Also the column/cells that contain the "Y" and "N" have been populated via the use of a formula; =IF(Accounts!M7="Paid", "Y", "N") for example.

    Thanks

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Sum values in column A ONLY IF the value of the neighbouring column B is a certain val

    Can you post a sample sheet. go to "Go Advanced" / "Manage attachments".

  6. #6
    Registered User
    Join Date
    08-03-2016
    Location
    England
    MS-Off Ver
    Office 2016
    Posts
    5

    Re: Sum values in column A ONLY IF the value of the neighbouring column B is a certain val

    Spreadsheet attached.

    Thanks
    Attached Files Attached Files

  7. #7
    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,048

    Re: Sum values in column A ONLY IF the value of the neighbouring column B is a certain val

    Can text format settings interfere with a formula? The column I want SUM'ed is set as Currency?
    if the currency column is text looking like a number, then yes that would cause it to fail.
    Test with =isnumber(cell-ref)

    Also the column/cells that contain the "Y" and "N" have been populated via the use of a formula; =IF(Accounts!M7="Paid", "Y", "N") for example.
    see my post # 3

  8. #8
    Registered User
    Join Date
    08-03-2016
    Location
    England
    MS-Off Ver
    Office 2016
    Posts
    5

    Re: Sum values in column A ONLY IF the value of the neighbouring column B is a certain val

    Ah Okay, so the formula reliant on another formula thing shouldn't really pose a problem.

    I will check the formatting as well to ensure it's not a silly mistake.

    Thank you

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Sum values in column A ONLY IF the value of the neighbouring column B is a certain val

    For Monthly front sheet for (e.g. May : =SUMIF(F:F,"N",E:E)

  10. #10
    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,048

    Re: Sum values in column A ONLY IF the value of the neighbouring column B is a certain val

    Correct, it does not matter if the cell being referenced contains a manual entry or a formula, excel works on what is displayed in the cell

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Sum values in column A ONLY IF the value of the neighbouring column B is a certain val

    Criteria range - where you expect to find the criteria (N in your case),
    Criterion - N
    Sum range - the cells that meet the criterion to be summed.

    My guess is that you swapped the first and last around.

  12. #12
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Sum values in column A ONLY IF the value of the neighbouring column B is a certain val

    I finally located where you had tried the formula. the problem was that in April there are no amounts that have an N against them. Therefore the total is 0.00

  13. #13
    Registered User
    Join Date
    08-03-2016
    Location
    England
    MS-Off Ver
    Office 2016
    Posts
    5

    Re: Sum values in column A ONLY IF the value of the neighbouring column B is a certain val

    Excellent problem solved!

    A little embarrassing however the formula given worked all along, the values it omitted would have always returned a value of 0 for the month I was testing. I wanted it to show bills that are outstanding, the month I was checking doesn't have any....

    None the less, thank you both for your advice.

    Thanks,
    Adam

  14. #14
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Sum values in column A ONLY IF the value of the neighbouring column B is a certain val

    One thing is for sure. you won't make that mistake again. But there are plenty of other mistakes to make!!!

  15. #15
    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,048

    Re: Sum values in column A ONLY IF the value of the neighbouring column B is a certain val

    You can say that again, Glenn lol

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Bring along the neighbouring data into adjacent column
    By raimy haidar in forum Excel General
    Replies: 0
    Last Post: 02-14-2015, 09:21 AM
  2. Sumproduct of column based on text search of neighbouring column
    By anthropormorph in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-01-2015, 10:51 AM
  3. Fill in cells with a value based on a neighbouring column
    By ppataki in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 08-26-2014, 11:18 AM
  4. Filling blank cells based on neighbouring column
    By ppataki in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-02-2009, 06:28 AM
  5. Replies: 6
    Last Post: 08-15-2009, 04:45 PM
  6. Copying cells to the neighbouring column in pairs along Row 1
    By shmee150 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 03-13-2009, 12:23 PM
  7. Replies: 3
    Last Post: 01-10-2006, 06:10 AM

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