Nested IF function

haj284

New Member
Joined
Jul 10, 2012
Messages
14
Someone please help me with these formulas! I am so upset I can not figure these out. PLEASE HELP :(

1. Enter a formula to calculate the number of gallons billed, based on the following rules: If a customer's bill is waived (Bill Waived column) or the number of gallons used is less than 25,000 (Gal Used column), display 0 in Gal Billed column; otherwise display the value from the gallon used column in the gal billed column

2. Enter a Formula to calculate the water bill based on the following rules: The billing rate varies based on the type pf customer (cust type column). The billing rate is $3, $2, or $1.50 per thousand gallons billed, depending on the customer type(see the lookup table in cells b2:c5 of the billing rate worksheet)

**billing rate COM-$3 NPROFIT-$2 Gov-$1.50**

heres what my worksheet looks like. please help me with what each of these formulas are.

Customer NameCust TypeBill WaivedTaxableBilling YearGal UsedGal BilledWater bill
Red Lake ChapterNPROFITNoYes2013108,300
Amity ChurchNPROFITYesNo201355,160
Church of ChristNPROFITYesNo201332,430
NM State HighwayGOVNoNo201395,660
Spot Free Power WashCOMNoYes2013281,200
CIT Apartment ComplexCOMNoYes2013257,000
Housing AgencyGOVNoNo201323,300
Pinon Pizza EdgeCOMNoYes201381,110
Department of AgricultureGOVNoNo20132,783,000
Chevron StationCOMNoYes20131,131,600

<TBODY>
</TBODY><COLGROUP><COL><COL><COL><COL><COL><COL><COL span=2></COLGROUP>
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Hi Haj,

For #1 try:

=IF(OR(C2="Yes",F2<25000),0,G2)

This assumes "Bill Waived" is column C, "Gal Used" is column F, "Gal Billed" is column G, and your data starts in row 2. Adjust accordingly if your data layout is different.

For #2, perhaps:

=LOOKUP(B2,{"COM","GOV","NPROFIT"},{3,1.5,2})*(INT(G2/1000))

This divides G2 ("Gal Billed") by 1000 then cuts off the decimal portion (no rounding), then multiplies that amount by 3, 1.5 or 2, depending on the value in B2. The lookup array is in ascending alphabetical order, so the result array must be in the corresponding order.
 
Upvote 0
Those values are correcct, but when I input the formula G2 is returning 0...which according to the rules I don't think it should? or am I doing something wrong?
 
Upvote 0
You could be doing something wrong, or your values might not be exactly the same (extra spaces?) I can't really tell without seeing your workbook.
 
Upvote 0
Edit the first formula to:

=IF(OR(C2="Yes",F2<25000),0,F2)

With G2 as the last argument, and the formula being in cell G2, a circular reference would be created. We don't want that.
 
Upvote 0
Also, when I copied your data from this page into Excel there were extra spaces after the Yes's and No's in the Bill Waived column. If those exist in your actual data, remove them. (Use the Find/Replace dialog after selecting those cells. Replace a space character with nothing.)
 
Upvote 0
oh my gosh, that worked :) you are amazing!!!! so would the formula for #2 be =LOOKUP(B2,{"COM","GOV","NPROFIT"},{3,1.5,2})*(INT(G2/1000))

like you initially said?
 
Upvote 0

Forum statistics

Threads
1,215,537
Messages
6,125,389
Members
449,222
Latest member
taner zz

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