# Nesting IF?

#### Szucchari

##### New Member
 Billable / Non-Billable Electronic / Mail Page Cost search Fee Y/N Search Fee PDF Postage Total Billed Billable Mail \$\$ Y \$10.00 \$6.50 \$\$ =\$\$ Billable Electronic - Y \$10.00 \$6.50 - =\$\$ Non - Billable Mail or electronic 0 N - - =\$0 Non- Billable Mail 0 Y 10.00 0 \$10.00

<tbody>
</tbody>
Hi All,

Please let me know if I am thinking correctly or if I am totally wrong. below is what I am trying to make happen and I am with the limited excel knowledge I have, I am thinking my only logical way is to do a nesting IF but this will most likely be the longest IF in history lol and I am not sure if I can pull it off or if it will even work.

If A2 is billable and B2 is Mail and D2 is Y , then I need H2 = C2+E2+G2
If A2 is Billable and B2 is electronic and D2 is Y, Then I need H2 = E2 + F2
If A2 is Non-Billable and D2 is N, then H2 = 0
If A2 is Non-Billable and D2 is Y, then H2 = 10

### Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

#### kweaver

##### Well-known Member
Phew! Maybe:

Code:
``=IF(AND(A2="billable",NOT(ISERROR(FIND("Mail",B2))),D2="y"),C2+E2+G2,IF(AND(A2="billable",NOT(ISERROR(FIND("Electronic",B2))),D2="y"),E2+F2,IF(AND(A2="non-billable",D2="n"),0,10)))``

NOTE: The FIND function is case-sensitive, so Mail and Electronic have to have 1st letter in upper-case in the B column or change the IF statement.

Last edited:

#### Eric W

##### MrExcel MVP
You seem to have left out a lot of cases. For example, is "Mail or Electronic" a valid code, or just an indication of both possibilities? But if I understand the underlying rules correctly, you might get away with something like this:

=IF(A2="Billable",(D2="Y")*E2+IF(B2="Mail",C2+G2,F2),0)

#### Szucchari

##### New Member
Thank you!!! I never would have been able to come up with that!

Replies
7
Views
372
Replies
12
Views
275
Replies
11
Views
204
Replies
6
Views
854
Replies
11
Views
264

1,170,935
Messages
5,872,807
Members
432,948
Latest member
Yordi

### 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.

### Which adblocker are you using?

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

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