+ Reply to Thread
Results 1 to 11 of 11

Sumproduct between range

  1. #1
    Forum Contributor
    Join Date
    05-15-2015
    Location
    Orlando, FL
    MS-Off Ver
    Office Standard 2016
    Posts
    266

    Sumproduct between range

    Hello everyone,

    I have a query producing data and unfortunately our sub-ledger units appear to cause some issues with Excel. When the query produces into excel, it comes with a space in front of it, for example " 6102300". I'm in need of a formula that can sum between two ranges while somehow ignoring this space. I've tried converting to number, text, general and not having much luck with a sumif or sumproduct function. In the attached example, I'm trying to sum amounts from column D between 6102000 and 6103999. Can someone let me know what I'm doing wrong?

    Thanks for the help.
    Attached Files Attached Files

  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 2403
    Posts
    43,984

    Re: Sumproduct between range

    4000 rows makes manual checking a little difficult. I cut it back to a real SAMPLE, 15 rows.

    1. Replace values in I4 and J4 with numbers.

    2. Select column E. Data/Text to columns/Finish.

    3. =SUMPRODUCT((E4:E20>=I4)*(E4:E20<=J4),D4:D20) now works.
    Attached Files Attached Files
    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.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

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

    Re: Sumproduct between range

    Ignore Post 2. Back in a minute!!

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

    Re: Sumproduct between range

    OK. minor error in description.

    4000 rows makes manual checking a little difficult. I cut it back to a real SAMPLE, 15 rows.

    1. Replace values in I4 and J4 with numbers.

    2. Add anything to E1 and E2. Select column E. Data/Text to columns/Finish. Deletet whatever was in E1 and E2.... or...
    Select E4 to the end instead.

    3. =SUMPRODUCT((E4:E20>=I4)*(E4:E20<=J4),D4:D20) now works.
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    05-15-2015
    Location
    Orlando, FL
    MS-Off Ver
    Office Standard 2016
    Posts
    266

    Re: Sumproduct between range

    Appreciate it, but not sure this will work. I need to analyze the full range and when I extend the formula, its not pulling anything. I can't control the data in column E in terms of the spacing it puts in front of the number. If I manually type in the number, then yes the formula works. Is there anyway to address the spacing issue within the formula?

  6. #6
    Forum Contributor
    Join Date
    05-15-2015
    Location
    Orlando, FL
    MS-Off Ver
    Office Standard 2016
    Posts
    266

    Re: Sumproduct between range

    Actually I apologize, your formula is working. Thank you!

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

    Re: Sumproduct between range

    Works fine for me, if you follow the instructions in Post 4. It produces a number. I have not done any manual checking!!
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    05-15-2015
    Location
    Orlando, FL
    MS-Off Ver
    Office Standard 2016
    Posts
    266

    Re: Sumproduct between range

    Appears everytime i refresh the query, it goes back to showing 0.00. Would a sumproduct function solve this issue?

  9. #9
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,210

    Re: Sumproduct between range

    whats to stop a global replace of space with nothing at the beginning?, then they all become numbers and it should work?

  10. #10
    Forum Contributor
    Join Date
    05-15-2015
    Location
    Orlando, FL
    MS-Off Ver
    Office Standard 2016
    Posts
    266

    Re: Sumproduct between range

    Can you clarify would you mean here:
    Add anything to E1 and E2. Select column E. Data/Text to columns/Finish. Deletet whatever was in E1 and E2.... or...
    Select E4 to the end instead.

  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 2403
    Posts
    43,984

    Re: Sumproduct between range

    If this is something you're constantly refreshing, go with davsth's idea. use something like:

    =IFERROR(TRIM(E4)+0,"")

    in G4 copied down. Reformat I4 and J4 as numbers


    =SUMPRODUCT((G4:G6000>=I4)*(G4:G6000<=J4),D4:D6000)
    Attached Files Attached Files

+ 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. Replies: 2
    Last Post: 01-20-2017, 04:27 PM
  2. [SOLVED] Sumproduct using range as criteria to compare another range
    By lukihnio in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-25-2016, 11:07 AM
  3. Replies: 1
    Last Post: 12-17-2015, 11:22 AM
  4. Replies: 8
    Last Post: 05-14-2012, 02:44 PM
  5. Replies: 15
    Last Post: 04-25-2012, 05:21 PM
  6. SumProduct Formula Count Entries in a range if another range is = 1
    By realniceguy5000 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-15-2011, 02:13 PM
  7. Range=Range as condition in Sumproduct
    By osmdian in forum Excel General
    Replies: 1
    Last Post: 08-26-2008, 10:06 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