I have solved it using (Nested IF + SUM) . . is there a better formula to solve it?

Anonymous
2022-08-30T08:05:15+00:00

Respected Experts!

Is there a more efficient formula (compared to the formula I used) to find the Total Cost?

My dilemma: My formula would get really long if there were more bins/ranges in column#A.

Thank You!

Best Wishes!

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes
Answer accepted by question author
  1. Anonymous
    2022-08-30T13:47:53+00:00

    @MMW.... Does the URL contain a better explanation (captured in 2007; the webpage might be even older): http://www.mcgimpsey.com/excel/variablerate.html

    (Caveat: That seems to be a slow link. Give it time to load.)

    Thus, your table becomes:

    Image

    Formulas:

    C2: =B2-N(B1)

    F2: =SUMPRODUCT((E2>=$A$2:$A$4)*(E2-$A$2:$A$4), $C$2:$C$4)

    The addition of column C allows the SUMPRODUCT formula in column F to be normally-entered in all versions of Excel.

    It is also more efficient because it removes a constant calculation. And it might be more self-explanatory.

    How it works..... The first calculation (E2-A2)*C2 applies the first cost per unit to the entire amount (E2). In this case, that overstates the cost for weights above 201. So the second calculation (E2-A3)*C3 subtracts the overage for the __all__ of the remaining amount. But that still overstates the cost for weights above 301. So the third calculation (E2-A4)*C4 subtracts the additional overage for __final__ remaining amount.

    PS.... You can also enter 0, 200, 300 into column A and change first term of the SUMPRODUCT to E2>$A$2:$A$4. I choose the form that fits the problem description.

    1 person found this answer helpful.
    0 comments No comments
Answer accepted by question author
  1. Vijay A. Verma 104.7K Reputation points Volunteer Moderator
    2022-08-30T08:36:53+00:00

    This is called slab billing and I have covered this here - https://eforexcel.com/wp/article-31-slab-billing-calculate-income-tax-electricity-utility-bills-based-on-slabs/

    Align your data as below and put following formula in E2

    =SUMPRODUCT((D2>$A$2:$A$4)*(D2-$A$2:$A$4)*($B$2:$B$4-IFERROR(--$B$1:$B$3,0)))

    1 person found this answer helpful.
    0 comments No comments

4 additional answers

Sort by: Most helpful
  1. Anonymous
    2022-09-02T07:37:14+00:00

    This happens to be the first 365 function I added to my library. :>)

    Image

    Thank You @Rand2201 for Your response. Appreciate!

    0 comments No comments