Complicated IF AND Statement Help

Cantrecallmyusername

Board Regular
Joined
May 24, 2021
Messages
50
Office Version
  1. 365
Platform
  1. Windows
Hi there,

I am trying to create a formula that hits a number of parameters and after several attempts I am not sure if it is actually possible - the formula needs to combine quite a number of parameters to work;
The premise for the formula is a s/s to track when people leave/join -

  • hours are calculated per column based on the values in cells M2/M3 * column L (depending on region)
  • when someone leave and the date matches M5 the value should be zero and continue to be zero going to the right (the date will change in each column though)
    • I thought about handling this by including an extra IF statement once the below is correctly designed where the column N looks to the left and if the value in M is zero it will return a zero
  • when someone joins and the date matches M5 the value should be calculated using the hours per their region (he date will change in each column though)
    • Not sure on how to handle this one at the moment

  1. IF Column F = "No" AND Column J = "Space" - M2*L6
  2. IF Column F = "No" AND Column J = "Earth" - M3*L6
  3. IF Column G = "Y" AND Column H = M5 AND Column J = "Space" - M2*L6
  4. IF Column G = "Y" AND Column H = M5 AND Column J = "Earth" - M3*L6
  5. IF Column F = M5 = 0

My formula works in places but I think as I have to many similar outcomes it is difficult to ascertain a true FALSE - as seen in the example shared it pushes the value to 0 when not meeting all the sperate condtions. Any help greatly appreciated.

Excel Formula:
=IF(AND(G6="Y",H6=M$5,J6="EARTH"),$M$3*L6,IF(AND(G6="Y",H6=M$5,J6="SPACE"),$M$2*L6,IF(F6=M$5,0,IF(AND(F6="No",G6="",J6="EARTH"),$M$3*L6,IF(AND(F6="No",G6="",J6="SPACE"),$M$2*L6,0)))))

Book1
ABCDEFGHIJKLM
1
236.5
335.0
4
5ResourceRoleRole#2LeaverJoinerRegionGap1No.08/07/2022
6Donald DuckDuckDuckNoSPACE136.5
7Bugs BunnyBunnyBunnyNoYSPACE10.0
8PlutoDogDog08/07/2022EARTH10.0
9
10
11
Sheet1
Cell Formulas
RangeFormula
M6:M8M6=IF(AND(G6="Y",H6=M$5,J6="EARTH"),$M$3*L6,IF(AND(G6="Y",H6=M$5,J6="SPACE"),$M$2*L6,IF(F6=M$5,0,IF(AND(F6="No",G6="",J6="EARTH"),$M$3*L6,IF(AND(F6="No",G6="",J6="SPACE"),$M$2*L6,0)))))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A7:A8Dates OccurringyesterdaytextNO
A7:A8Cell ValueduplicatestextNO
A5:A6Dates OccurringyesterdaytextNO
A5:A6Cell ValueduplicatestextNO
 
You're welcome. Glad we could help.
Showing more of your data in Post #8 made it much easier to work out the requirement.
Let me know if you need help understanding it. I am sure it can be done with a more technically correct approach but since for Leaver there were possibilities of Blank, Text (No or otherwise & Date, I opted for using the Date if it existed and if not use a date after the end date of the Date range so that the If statement became a simple date comparison. Then used consistent logic for Joiner.
 
Upvote 0

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

Forum statistics

Threads
1,224,618
Messages
6,179,917
Members
452,949
Latest member
beartooth91

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