+ Reply to Thread
Results 1 to 9 of 9

Sum if a number is contained in a list

  1. #1
    Valued Forum Contributor
    Join Date
    04-21-2005
    Location
    Southern England
    MS-Off Ver
    Excel for Office 365
    Posts
    1,689

    Sum if a number is contained in a list

    Hi,
    I need some help with either a sumif or sumproduct formula if possible...

    I have uploaded an example file and I need a formula to sum only the entries that are listed on the lookup sheet which match the contract name.

    In order to do this the formula will need to look in column G and if there is a match on the lookup sheet then sum column Q. It would also need to match the contract name column U with Column B

    I have provided an example of what I need as my description is not very clear.

    The formulas would be required in the pink cells.
    Attached Files Attached Files

  2. #2
    Forum Contributor vamosj's Avatar
    Join Date
    04-23-2004
    Location
    Oregon
    MS-Off Ver
    2010
    Posts
    294

    Re: Sum if a number is contained in a list

    In Cell V15

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Adjust column range to meet your needs, then copy and paste down. The way your spreadsheet is set up the calcluations are done manualy (after each enter), if you want it to automatically calculate you'll have to change that in the calculation options.
    Janos S. Vamos
    Data Systems Technician/Fire Controlman PO1(SW/AW)
    US Navy Retired


    Remember, Record Macro can be your friend for figuring out solutions.

    Good or Bad, let me know how I did by clicking on the "Add Reputation" * just to the lower left of here. it only takes a few seconds to let someone know.

  3. #3
    Forum Contributor amit.wilson's Avatar
    Join Date
    07-09-2013
    Location
    Gotham
    MS-Off Ver
    Excel for Mac 2011
    Posts
    283

    Re: Sum if a number is contained in a list

    Hi Paul,

    try this in W2:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    This is an array formula and as you may know, you'll need to press CTRL+SHIFT+ENTER instead of plain old ENTER when keying it in.

    Let me know if it worked.

    Cheer
    <-- If you're happy & you know it...click the star.:-)

  4. #4
    Valued Forum Contributor
    Join Date
    04-21-2005
    Location
    Southern England
    MS-Off Ver
    Excel for Office 365
    Posts
    1,689

    Re: Sum if a number is contained in a list

    Hi,

    I tried the formula and it worked for the first product but not for the cell in W6. Why would this be?
    Attached Files Attached Files

  5. #5
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Sum if a number is contained in a list

    Cell G8 of your second sample sheet is formatted as text. Change it to General format.

    non-array alternative..
    =SUMPRODUCT($Q$2:$Q$10,($B$2:$B$10=U2)*(ISNUMBER(MATCH($G$2:$G$10,Lookup!$C$2:$C$43,0))))
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  6. #6
    Forum Contributor vamosj's Avatar
    Join Date
    04-23-2004
    Location
    Oregon
    MS-Off Ver
    2010
    Posts
    294

    Re: Sum if a number is contained in a list

    Quote Originally Posted by pauldaddyadams View Post
    Hi,

    I tried the formula and it worked for the first product but not for the cell in W6. Why would this be?
    Sorry, I missed the pink cells portion of the post... Reworking the formula.

  7. #7
    Valued Forum Contributor
    Join Date
    04-21-2005
    Location
    Southern England
    MS-Off Ver
    Excel for Office 365
    Posts
    1,689

    Re: Sum if a number is contained in a list

    That formula worked ACE, however I have just been informed of another element Arraaghh

    Is there any way I can adapt this:
    =SUMIF($B$2:$B$10,U2,$Q$2:$Q$10)

    So it looks in column N and does a similar match as the above example where it matches a list (column F) on the sheet lookup.

    I also need to adjust the other formula given to add in this additional element
    =SUMPRODUCT($Q$2:$Q$10,($B$2:$B$10=U2)*(ISNUMBER(MATCH($G$2:$G$10,Lookup!$C$2:$C$43,0))))
    Attached Files Attached Files

  8. #8
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Sum if a number is contained in a list

    Try..

    =SUMPRODUCT($Q$2:$Q$10,($B$2:$B$10=U2)*(ISNUMBER(MATCH($G$2:$G$10,Lookup!$C$2:$C$43,0)))*(ISNUMBER(MATCH($N$2:$N$10,Lookup!$F$2:$F$5,0))))

  9. #9
    Valued Forum Contributor
    Join Date
    04-21-2005
    Location
    Southern England
    MS-Off Ver
    Excel for Office 365
    Posts
    1,689

    Re: Sum if a number is contained in a list

    Thanks once again I couldnt get this to work so I will test it and come back to you

+ 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. [SOLVED] Identify if a number is contained within 40 or more number ranges
    By HealthyB in forum Excel General
    Replies: 5
    Last Post: 02-10-2013, 08:22 PM
  2. List based on value contained in cell
    By Steve_Courts in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-06-2009, 08:07 PM
  3. Replies: 6
    Last Post: 03-07-2008, 03:40 PM
  4. Looking up whether a value is contained in an unsorted list of strings
    By lordhed in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 04-01-2007, 07:51 AM
  5. [SOLVED] view list of worksheets contained within a workbook
    By michael in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-09-2005, 05:06 PM

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