What should be an ideal Formula to fulfill the condition ?

RapchikM

Board Regular
Joined
Oct 5, 2020
Messages
97
Office Version
  1. 2021
Platform
  1. Windows
Hello

What should be ideal formula to get desired answer ?


Range of UnitsUnits ConsumedRateAmt
Col CCol DCol ECol F
000-100 Units1001.65165
000-100 Units2004.20840
301-500 Units
2007.651530
Above 500 Units
5008.353825

Cell B9 = 510 ie Total Units Consumed
Cell F9 contains following Formula . =(VLOOKUP(B9,$D$3:$F$6,3)+(B9)-(LOOKUP(B9,$D$3:$F$6)))*VLOOKUP(B9,D$3:F$6,2)
Which gave answer as 4258.50
instead of 2618.50

basically it goes if units Consumed
Less than 500 then 100 X 1.65 = 165.00
200 X 4.20 = 840.00
200 X 7.65 = 1530.00
10 X 8.35 = 83.50 I dont know what condition is required here Tried many things and it got messed up and i am confused
TOTAL 2618.50

I tried putting the Following formula too

=IF(ISNA(VLOOKUP(B9,$D$3:$F$6,3,FALSE))=TRUE,F3,VLOOKUP(B9,$D$3:$F$6,3,FALSE))+IF(ISNA(VLOOKUP(B9,$D$3:$F$6,3,FALSE))=TRUE,F4,VLOOKUP(B9,$D$3:$F$6,3,FALSE))+IF(ISNA(VLOOKUP(B9,$D$3:$F$6,3,FALSE))=TRUE,F5,VLOOKUP(B9,$D$3:$F$6,3,FALSE))+IF(ISNA(VLOOKUP(B9,$D$3:$F$6,3,FALSE))=TRUE,F6,VLOOKUP(B9,$D$3:$F$6,FALSE))

The answer came up was as 6360

Require your help to correct it
Thanks in advance

RapchikM
 
Last edited:

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
A bit lengthy but wroking

Receip.xlsm
ABCDEFGHIJ
1000-100 Units1001.65165UnitsBill
2100-200 Units2004.28405002,535.00
3301-500 Units2007.651530200585.00
4Above 500 Units5008.3538255102,618.50
56003,370.00
67504,622.50
7
8
9
Sheet19
Cell Formulas
RangeFormula
G2:G6G2=IF(F2<=100,100*1.65,IF(F2<=200,((100*1.65)+(F2-100)*4.2),IF(F2<=500,((100*1.65)+(200*4.2)+((F2-300)*7.65)),((100*1.65)+(200*4.2)+(200*7.65)+((F2-500)*8.35)))))
 
Upvote 0
Muhammad Usman
RangeFormula
Cell Formulas
G2:G6G2=IF(F2<=100,100*1.65,IF(F2<=200,((100*1.65)+(F2-100)*4.2),IF(F2<=500,((100*1.65)+(200*4.2)+((F2-300)*7.65)),((100*1.65)+(200*4.2)+(200*7.65)+((F2-500)*8.35)))))

Thanks very much for deriving the correct result and applying on different Units and Getting Amt Values.

What i don't get is using your formula How Can someone fix a defined Value for eg.
+(F2-100)*4.2)
+((F2-300)*7.65))
+((F2-500)*8.35)
ie defining 100, 300 and 500. Following value 300 is not shown in column B. I was much determined to get the values from Column itself

Will appreciate your explanation
RapchikM
 
Upvote 0
If you are prepared to change your lookup table set up, then this might work for you.

Book2
ABCDEFGHI
1RangeFromToBase AmtRateIncremental Max (optional)UnitsBill
2000-100 Units010001.651655002,535.00
3100-200 Units1003001654.2840200585.00
4301-500 Units3005001,0057.6515305102,618.50
5Above 500 Units5002,5358.356003,370.00
67504,622.50
Data
Cell Formulas
RangeFormula
F2:F4F2=(C2-B2)*E2
B2:B5B2=N(C1)
D3:D5D3=(C2-B2)*E2+D2
I2:I6I2=VLOOKUP(H2,$B$2:$E$5,3,TRUE)+VLOOKUP(H2,$B$2:$E$5,4,TRUE)*(H2-VLOOKUP(H2,$B$2:$E$5,1,TRUE))
 
Upvote 0
Solution
Dear Alex Sir,

Very much appreciated. This gives very nice clarity and easy break up.

BTW what does in B2 Cell indicate as =N(C1)

Thanks and Regards
RapchikM
 
Upvote 0
Thanks for letting us know, Glad we coule help.
In terms of =N(C1), the N function turns text to 0 and for numbers returns the number.
I wasn't terribly consistent since I was just trying to set up the sample table but the theory is that when you have a table it is preferable to have the same formula in "all" the rows.
Unfortunately when you are referencing the previous row, row 1 is referring to the heading which is usually text. By using the N function the first data row handles the fact that the previous row was the heading text and gave the 0 as the starting amount which is what the sequence needed.
It works for when you want row numbers too ie rather than enter row 1 as a hard coded "1" then have the following rows as a formula being previous row + 1 ie A2 + 1. You can have a consistent formula being N(A1) +1 copied down as N(A2) + 1 etc.
 
Upvote 0
Dear Alex Sir,

Thank you so much for the detailed explanation. This is now understood with much clarity and will remember for future.

Thanks once more for the reply and solution. :)🥂

Regards
RapchikM
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top