Multiple nested IF(AND formula troubleshooting

Stuepef

Board Regular
Joined
Oct 23, 2017
Messages
128
Office Version
  1. 2021
Platform
  1. Windows
I created a auto-calculate spreadsheet to display Employer contribution % for both employees and dependents (enter % in specific cell). To account for the many combinations of 0%-100%, I have tried to encompass the following combinations in a nested IF(AND statement. I am looking to put different %'s in cells A1 & A2 to calculate how much the employer and the employee have to pay.

Employer Contribution %Employer Contribution %
EmployeeDependent
0%0%
100%0%
100%100%
1%-99%0%
1%-99%1%-99%
100%1-99%

<tbody>
</tbody>

Here is how my spreadsheet looks:
Employer Contribution %
Employee % (Cell A1)
Dependent % (Cell A2)
(Cell A4)(Cell B4)(Cell C4)(Cell D4)(Cel E4)(Cell H4)(Cell I4)(Cel J4)
NameEmployeeSpouseChildrenTotalEmployerEmployeeTotal
Johnson$100$100$100$300IF(AND

<tbody>
</tbody>


My formula works out perfectly, except when I added the last line causing the result to be FALSE. If I separate the last line, than the formula works like it should, but for whatever reason, it doesn't when I attach it to the bigger formula. I am trying to troubleshoot why I am receiving the FALSE answer when I put 100% in A1 and 50% in A2.

Here is my current formula:
Code:
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; white-space: inherit;">=IF(AND(A1=0%,A2=0%),0,
IF(AND(A1=100%,A2=0%),B4,
IF(AND(A1=100%,A2=100%),E4,
IF(AND(A1>1%,A1<=99%,A2=0%),A1*B4,
IF(AND(A1>1%,A1<=99%,A2>1%,A2<=99%),(SUM(C4:D4)*A2)+(A1*B4,
IF(AND(A1=100%,A2>1%,A2<=99%),(SUM(C4:D4)*A2)+(A1*B4))))))))</code>
 
Glad to help! It does make sense to separate out cases for ease of understanding, but oftentimes you can take an extra step and see if any of the cases can be combined. In some situations you'd still want to keep them separate to see better what's going on, but this time, I think the shorter formula works out pretty well.

Good luck!
 
Upvote 0

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.

Forum statistics

Threads
1,215,368
Messages
6,124,520
Members
449,169
Latest member
mm424

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