Formula to subtract 1 if 2 of 2 criteria are met...

Sleeplol

Board Regular
Joined
Apr 10, 2019
Messages
194
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hello,

Would appreciate some help with this formula.

I'm attempting to subtract 1 day from the date (Column A) based on 2 criteria: (Column C value = "Nigh Shift" and (Column B time is between H1 and H2.
If both of these criteria are met then Column D should read Date - 1 day. If only 1 criteria or no criteria are met then Column D date should equal Column A date (Column E is what I am going for).

So far I have this formula:
IF(ISNUMBER(SEARCH("Night Shift",C2)),IF(AND([@Time]>$J$1,[@Time]<$J$2),[@Date]-1,""),A2)

Which seems to work sometimes; don't know what happened with rows 3 and 4 lol

Example2.jpg


Also, I swear I posted this question, but I when I went to update it I didn't see it in my threads. Please be merciful if it is found..
 
the formula in Column D isnt the updated formula (note it uses dateadd)
The updated formula is in post#6

Oh, my mistake.

Very slick. This works perfectly


Gordsky, thank you much for working me though this

G_Final.jpg
 
Upvote 0

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

Forum statistics

Threads
1,214,895
Messages
6,122,128
Members
449,066
Latest member
Andyg666

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