Help required in modifying IF Statement

grcshekar71

New Member
Joined
Apr 17, 2020
Messages
10
Office Version
  1. 2007
Platform
  1. Windows
=IF(INDEX(EmployeeMaster!O:O,MATCH(H2,EmployeeMaster!A:A,0))="Y",IF(SUM(Y2:AD2)>=SUM(S2:X2),0,IF(SUM(S2:X2)>15000,15000*12%,SUM(S2:X2)*12%)),0).

This formula is intended to work as follows.

IF SUM(S2:X2) - SUM(Y2:AD2) >= SUM(S2:X2) * 12%
THEN RESULT
ELSE 0

Also H2,EmployeeMaster!A:A,0))="Y" is only a flag check if Y then continue evaluating formula else no

But it is not working. It works only if SUM(Y2:AD2) = SUM(S2:X2)
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
=IF(INDEX(EmployeeMaster!O:O,MATCH(H2,EmployeeMaster!A:A,0))="Y",IF(SUM(Y2:AD2)>=SUM(S2:X2),0,IF(SUM(S2:X2)>15000,15000*12%,SUM(S2:X2)*12%)),0).

This formula is intended to work as follows.

IF SUM(S2:X2)> 15000 THEN IF 15000 * 12% >=SUM(S2:X2) - SUM(Y2:AD2) then 15000 * 12% else 0

ELSE SUM(S2:X2)< 15000 THEN IF SUM(S2:X2)* 12% >=SUM(S2:X2) - SUM(Y2:AD2) then SUM(S2:X2)* 12% else 0




Also H2,EmployeeMaster!A:A,0))="Y" is only a flag check if Y then continue evaluating formula else no
 
Upvote 0
Hi and welcome to MrExcel!

In your formula you have a condition, but in your explanation you put another condition.
Could you explain it, but with examples. Put here a generic sample of your data, where the different conditions and the result you require for each case.
Use XL2BB tool to put the data sample.
 
Upvote 0
Kindly go by explanation

If you see the attachment Column AE2 should have been 0 because the balance available is only 1000 and 1800 cannot be deducted. Rs 1800 is also produced from formula above and not an entered value
 

Attachments

  • DATA.JPG
    DATA.JPG
    150.6 KB · Views: 5
Upvote 0
Try this:

=IFERROR(IF(VLOOKUP(H2,EmployeeMaster!A1:O13,15,0)="Y",IF(SUM(S2:X2)>15000,IF(15000*12%>=(SUM(S2:X2) - SUM(Y2:AD2)), 15000*12%,0),IF(SUM(S2:X2)*12%>=(SUM(S2:X2) - SUM(Y2:AD2)),SUM(S2:X2)*12%,0)),"Employee without Y"),"Employee does not exists")
 
Upvote 0
Your understanding of concept i think is right. Just tried =IF(SUM(S2:X2)>15000,IF(15000*12%>=(SUM(S2:X2) - SUM(Y2:AD2)), 15000*12%,0),IF(SUM(S2:X2)*12%>=(SUM(S2:X2) - SUM(Y2:AD2)),SUM(S2:X2)*12%,0))

Sum of S2;X2 is 10000 sum of Y2:AD2 is 0. so this should calculate 10000*12% which it did not do
 
Upvote 0
Ok can you help me this way. Now this formula =IF((AND(SUM(S2:X2)<=15000, SUM(S2:X2)-SUM(Y2:AD2)>=SUM(S2:X2)*12%)), SUM(S2:X2)*12%, 0) works correctly. In the same forumula i Need to expand to check if it is SUM(S2:X2)>15000 then calculate SUM(S2:X2)*12% with other conditions being same
 
Upvote 0
Ok. I do understand. Now I wrote a formula like this

=IF((AND(SUM(S2:X2)<=15000, SUM(S2:X2)-SUM(Y2:AD2)>=SUM(S2:X2)*12%)), SUM(S2:X2)*12%, 0). This works the way i need it to. Now let us see this formula =IF((AND(SUM(S2:X2)>15000, SUM(S2:X2)-SUM(Y2:AD2)>=15000*12%)), 15000*12%, 0). Now I need to combine these two formula into one to make it work on both the conditions which ever is met subject to IF(INDEX(EmployeeMaster!O:O,MATCH(H2,EmployeeMaster!A:A,0))="Y",
 
Upvote 0
Sum of S2;X2 is 10000 sum of Y2:AD2 is 0. so this should calculate 10000*12% which it did not do

So your explanation is not clear.
You wrote this:

ELSE SUM(S2:X2)< 15000 THEN IF SUM(S2:X2)* 12% >=SUM(S2:X2) - SUM(Y2:AD2) then SUM(S2:X2)* 12% else 0

Continued with your example, that means:
SUM(S2:X2)* 12% = 10,000 * 12% = 1,200

SUM(S2:X2) - SUM(Y2:AD2)
10,000 - 0 = 10,000

1,200 >= 10,000 = False then result 0.
 
Upvote 0
Yes both IF Statement i have written to be combined so either of one IF is true it works else 0 on condition IF(INDEX(EmployeeMaster!O:O,MATCH(H2,EmployeeMaster!A:A,0))="Y",
 
Upvote 0

Forum statistics

Threads
1,221,418
Messages
6,159,790
Members
451,589
Latest member
Harold14

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