+ Reply to Thread
Results 1 to 13 of 13

Replace value by cell number in sumproduct function

  1. #1
    Registered User
    Join Date
    09-21-2018
    Location
    Hong Kong
    MS-Off Ver
    Office 365 version 16
    Posts
    17

    Replace value by cell number in sumproduct function

    Hi There,

    I am building a tiers pricing model with a rate that decrease depending on the number of hours commited. I have this formula using SUMPRODUCT that is working fine. However I would like to replace the numbers in the formula with cell so that when the cell number change I don't have to manually change the SUMPRODUCT formula. But when I do this I have error message poping up and don't seems to be able to link the cell to this formula

    =SUMPRODUCT(--(C16>{0,10,15,20,30,50,200,500,1000,2000}),--(C16-{0,10,15,20,30,50,200,500,1000,2000}),{800,-64,-54,-46,-40,-34,-30,-26,-23,-20})

    The first part of the formula is the range of hours
    (--(C16>{0,10,15,20,30,50,200,500,1000,2000}),--(C16-{0,10,15,20,30,50,200,500,1000,2000})

    I would like to simply replace each number with the cell where the number is

    The second part of the formula is the rate
    {800,-64,-54,-46,-40,-34,-30,-26,-23,-20})

    I would like to replace the number with the cell and the formula (ie : H4-H3)

    Thought appreciated

    Thanks!
    Attached Files Attached Files
    Last edited by DFHK; 09-24-2019 at 09:16 AM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,859

    Re: Sumproduct

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however the thread title does not really convey what your request is about.

    Please take a moment to amend your thread title. Make sure that the title properly explains your request. Your title should be explicit and not be generic (this includes function names used without an indication of what you are trying to achieve).

    Please see Forum Rule #1 about proper thread titles and adjust accordingly. To edit the thread title, open the original post to edit and then click on Go Advanced (bottom right) to access the area where you can edit your title.

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    09-21-2018
    Location
    Hong Kong
    MS-Off Ver
    Office 365 version 16
    Posts
    17

    Re: Replace value by cell number in sumproduct function

    Hi Alan,

    Thanks for the note. I have updated the title, please review and let me know if this is ok ... Thanks!

  4. #4
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,823

    Re: Replace value by cell number in sumproduct function

    I think this should work.
    =SUMPRODUCT(--(C16>C15:L15),--(C16-C15:L15),C14:L14)

  5. #5
    Registered User
    Join Date
    09-21-2018
    Location
    Hong Kong
    MS-Off Ver
    Office 365 version 16
    Posts
    17

    Re: Replace value by cell number in sumproduct function

    Not quite .... it does not output the right result ...

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: Replace value by cell number in sumproduct function

    Did you enter it using CTRL+SHIFT+ENTER (not just ENTER)?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  7. #7
    Registered User
    Join Date
    09-21-2018
    Location
    Hong Kong
    MS-Off Ver
    Office 365 version 16
    Posts
    17

    Re: Replace value by cell number in sumproduct function

    Quote Originally Posted by AliGW View Post
    Did you enter it using CTRL+SHIFT+ENTER (not just ENTER)?
    yes I have done that but the output is not right .... I am trying to upload the file

  8. #8
    Registered User
    Join Date
    09-21-2018
    Location
    Hong Kong
    MS-Off Ver
    Office 365 version 16
    Posts
    17

    Re: Replace value by cell number in sumproduct function

    I have attached the file ... please take a look

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: Replace value by cell number in sumproduct function

    So tell us what the output should be, please.

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: Replace value by cell number in sumproduct function

    Maybe you need this:

    =INDEX($C$4:$C$13,MATCH(G2,$A$4:$A$13,1))

    and this:

    =INDEX($D$4:$D$13,MATCH(G2,$A$4:$A$13,1))

  11. #11
    Registered User
    Join Date
    09-21-2018
    Location
    Hong Kong
    MS-Off Ver
    Office 365 version 16
    Posts
    17

    Re: Replace value by cell number in sumproduct function

    Quote Originally Posted by Gregb11 View Post
    I think this should work.
    =SUMPRODUCT(--(C16>C15:L15),--(C16-C15:L15),C14:L14)
    Quote Originally Posted by AliGW View Post
    So tell us what the output should be, please.
    In this case, there is a range of hours with a rate attached to each range. The hours' range and rate are nonlinear. For example

    5 -10 hours ----- rate 1000
    11 - 15 hours --- rate 950
    16 - 20 hours --- rate 900
    21 -30 hours --- rate 800

    So if the order is 25 hours the rate will be calculated as follow

    10 hours X $1,000
    5 hours X $950
    5 hours X $900
    5 hours X $800

    Total: 23,250. That will be the correct output which my formula return. When using the proposed formula then the result is 29,000

  12. #12
    Valued Forum Contributor Root_'s Avatar
    Join Date
    07-29-2017
    Location
    _
    MS-Off Ver
    2010+
    Posts
    484

    Re: Replace value by cell number in sumproduct function

    In your file, replace the "High", "Min Rate", and "Max Rate" headers with zeros, and try the following formulas:

    for Max Rate =SUMPRODUCT(--(G2>B3:B12),--(G2-B3:B12),ROUND(D4:D13-D3:D12,0))
    for Min Rate =SUMPRODUCT(--(G2>B3:B12),--(G2-B3:B12),ROUND(C4:C13-C3:C12,0))

    Those are normally-entered formulas -- no need to use Ctrl+Shift+Enter.

    You may need to play with rounding.

  13. #13
    Registered User
    Join Date
    09-21-2018
    Location
    Hong Kong
    MS-Off Ver
    Office 365 version 16
    Posts
    17

    Re: Replace value by cell number in sumproduct function

    Quote Originally Posted by Gregb11 View Post
    I think this should work.
    =SUMPRODUCT(--(C16>C15:L15),--(C16-C15:L15),C14:L14)
    Quote Originally Posted by Root_ View Post
    In your file, replace the "High", "Min Rate", and "Max Rate" headers with zeros, and try the following formulas:

    for Max Rate =SUMPRODUCT(--(G2>B3:B12),--(G2-B3:B12),ROUND(D4:D13-D3:D12,0))
    for Min Rate =SUMPRODUCT(--(G2>B3:B12),--(G2-B3:B12),ROUND(C4:C13-C3:C12,0))

    Those are normally-entered formulas -- no need to use Ctrl+Shift+Enter.

    You may need to play with rounding.
    Thanks root_ This works like a charm. However the rounding is creating some inaccurracy. How is the formula would like without the round dunction?

+ 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] Sumproduct with multiple variants - Help! I'm a newbie to sumproduct
    By KIGeorge in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-16-2019, 01:21 AM
  2. Combine sumif/sumproduct or sumproduct with multiple criteria
    By sab128 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-16-2018, 08:25 AM
  3. Count SUMPRODUCT Members / Average of SUMPRODUCT
    By Shingaru in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-10-2014, 03:59 PM
  4. Replies: 1
    Last Post: 05-19-2012, 02:54 AM
  5. Replies: 5
    Last Post: 04-20-2012, 08:54 AM
  6. Replies: 6
    Last Post: 03-09-2011, 08:01 AM
  7. Using a SumProduct Count to find a SumProduct Total?
    By XL021710 in forum Excel General
    Replies: 3
    Last Post: 02-18-2010, 08:31 AM

Tags for this Thread

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