+ Reply to Thread
Results 1 to 10 of 10

Sumif/sumproduct criteria based on integer portion only

  1. #1
    Forum Contributor
    Join Date
    08-14-2006
    Location
    USA
    MS-Off Ver
    2019
    Posts
    686

    Sumif/sumproduct criteria based on integer portion only

    XL2010

    Current formula:
    SUMIF(MyRngA, A2, MyRngB)

    MyRngA contains letters OR integers
    A2 contains integers

    I want to MyRngA to include decimals but the SUMIF to sum on the WHOLE NUMBER MATCH ONLY

    Something like:
    =SUMIF(INT((MyRngA), A2, MyRngB)
    =SUMIF(Rounddown((MyRngA,0), A2, MyRngB)

    So IF A2 contains 4, anytime cells in MyRngA contain 4, 4.1, 4.5, 4.9 etc will be included in the sum

  2. #2
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: Sumif/sumproduct criteria based on integer portion only

    =sumproduct(--(Int(MyRngA)= A2), MyRngB)

  3. #3
    Forum Contributor
    Join Date
    08-14-2006
    Location
    USA
    MS-Off Ver
    2019
    Posts
    686

    Re: Sumif/sumproduct criteria based on integer portion only

    Doesn't work because INT() on TEXT results in an error

    MyRngA contains letters OR integers

  4. #4
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: Sumif/sumproduct criteria based on integer portion only

    then
    =sumproduct(--(Int(--MyRngA)= A2), MyRngB), it is wrong
    please upload examples of strings in MyRngA
    or look in the attached file
    Attached Files Attached Files
    Last edited by tim201110; 04-28-2017 at 03:21 PM.

  5. #5
    Forum Contributor
    Join Date
    08-14-2006
    Location
    USA
    MS-Off Ver
    2019
    Posts
    686

    Re: Sumif/sumproduct criteria based on integer portion only

    see attached example

    my data are really tables but it fails without tables
    Attached Files Attached Files

  6. #6
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: Sumif/sumproduct criteria based on integer portion only

    =SUM(IFERROR((INT(MyRngA)= A2)*MyRngB,)) as arrayformula

  7. #7
    Forum Expert avk's Avatar
    Join Date
    07-12-2007
    Location
    India
    MS-Off Ver
    Microsoft Office 2013
    Posts
    3,223

    Re: Sumif/sumproduct criteria based on integer portion only

    try also in "A5"
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    atul


    If my answer (or that of other members) has helped you, please say "Thanks" by clicking the Add Reputation button at the foot of one of their posts.

    Also: if your problem is solved, please take the time to mark your thread as SOLVED by going to the top of your first post, selecting "Thread Tools" and then "Mark thread as solved".

  8. #8
    Forum Contributor
    Join Date
    08-14-2006
    Location
    USA
    MS-Off Ver
    2019
    Posts
    686

    Re: Sumif/sumproduct criteria based on integer portion only

    The correct answer is 120

    Match the integer 4 in
    F5 = 4
    F12 = 4.7
    F19 = 4.6

    G5 = 40
    G12 = 40
    G19 = 40

    40+40+40 = 120

  9. #9
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,169

    Re: Sumif/sumproduct criteria based on integer portion only

    Tim's formula gives the correct result (ARRAY entered)

    =SUM(IFERROR((INT(MyRngA)= A2)*MyRngB,))



    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.

  10. #10
    Forum Contributor
    Join Date
    08-14-2006
    Location
    USA
    MS-Off Ver
    2019
    Posts
    686

    Re: Sumif/sumproduct criteria based on integer portion only

    YES it does! I missed the array entry

    Thanks!

+ 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. SUMIF or SUMPRODUCT formula to SUM totals based on multiple criteria
    By relmasri in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 06-01-2016, 01:08 PM
  2. Copying a portion of a row based on cell criteria to another sheet
    By lucky.vjn in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-20-2015, 04:05 PM
  3. [SOLVED] Function to concatenate string based on a integer criteria
    By Tremper in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 11-19-2013, 10:03 AM
  4. Sumif or sumproduct with multiple criteria
    By msoregon91 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-24-2013, 03:56 PM
  5. [SOLVED] Sumif/sumproduct with a range as a criteria
    By fukirua in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 05-05-2013, 07:58 PM
  6. SUMPRODUCT or SUMIF using an array for criteria
    By rarascon in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-24-2013, 03:14 PM
  7. SUMIF Multiple Criteria or SUMPRODUCT?
    By gdwright07 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-02-2008, 12:15 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