Equation for marking activity based on date

david0925

New Member
Joined
Aug 2, 2017
Messages
3
Hi all, I am trying to do an equation that marks a person "active" or "inactive" based on the current date, the person's starting date, and the person's end date. Currently, I am using the equation
=IF(AND(F$2>=$D3,F$2<=$E3),"<wbr>Active","Inactive")
, where F2 is current date, D3 is starting date, and E3 is end date. This equation works for the most part, but it will mark a person "inactive" for the month if the person's end date happens in the middle of the month, and I want the person to be marked as active instead.


So I thought if I can do something like the following, it would probably work. However, the equation keeps returning error, so I am wondering if the code works at all and that i am just making syntax errors.


=IF(AND(and(month(F$2)>=month(<wbr>$D3), year(F$2)>=year($D3)), (and(month(F$2)<month($D3)), (year(F$2)<year($E3))),"<wbr>Active","Inactive")

In case that the above formula does not work or there are simpler solutions to my problem, what would be a better way to approach it?



Thank you
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
[FONT=arial, sans-serif]The code I posted above is not what I have typed in, and I do not see an edit button. The code that I have was
[/FONT]=IF(AND(and(month(F$2)>=month(<wbr style="font-family: arial, sans-serif; font-size: 12.8px;">$D3), year(F$2)>=year($D3)), (and(month(F$2)<month($D3)), (year(F$2)<year($E3))),"<wbr style="font-family: arial, sans-serif; font-size: 12.8px;">Active","Inactive")


 
Upvote 0
Apologies for multi posting, as the board does not give editing permissions. After I posted the correct code in post #2 it was converted to the "wrong" code again.

I have provided a .txt file from my dropbox folder containing the code that I was trying to use, hopefully it would display properly
Dropbox - Excelcode.txt
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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