Formula to look between 2 dates

Eurekaonide

Active Member
Joined
Feb 1, 2010
Messages
433
Hi
Wonder if you can help please.
I have a table with the months running along the top one month to each column (it defaults to the 1st of each month) so I have also added in above it the last day of each month.
so in column c row 1 it would say 31/10/2022 and in column c row 2 it would say 01/10/2022
Now in Row 3 column A is my start date and column B is an end date

what I want is for a formula to place a 1 in the C column (onwards) if the start date is between 1st-31st October and to place a 1 if the end date is between these dates.
this is so that each month it will show either a blank or a 1 depending on when something starts and finishes.

I had this but it doesnt seem to work

=IF(AND(A3<=C2,B3>=C1),1,"")

any help appreciated thanks
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
In that case the formula I supplied in post#2 does exactly what you asked for.
Fluff.xlsm
ABCDE
131/10/202230/11/202231/12/2022
2StartEnd01/10/202201/11/202201/12/2022
301/09/202201/11/202211 
425/10/202231/10/20221  
501/11/202201/12/2022 11
601/09/202228/09/2022   
Main
Cell Formulas
RangeFormula
C3:E6C3=IF(AND($A3<=C$1,$B3>=C$2),1,"")
 
Upvote 0
In that case the formula I supplied in post#2 does exactly what you asked for.
Fluff.xlsm
ABCDE
131/10/202230/11/202231/12/2022
2StartEnd01/10/202201/11/202201/12/2022
301/09/202201/11/202211 
425/10/202231/10/20221  
501/11/202201/12/2022 11
601/09/202228/09/2022   
Main
Cell Formulas
RangeFormula
C3:E6C3=IF(AND($A3<=C$1,$B3>=C$2),1,"")
Thanks I dont know what im doing wrong then. It is still placing a 1 for a start date in September but Im looking in the column for October.
 
Upvote 0
Does the mini-sheet in post#13 show the correct answers?
 
Upvote 0
In that case check that your dates are real dates. If you change the format of all the date cells to general do you still see dates?
 
Upvote 0
I think I may have solved it, would appreciate your feedback and thoughts.

=IF(OR(C$2>=$A3,C$1<=$A3,C$2>=$B3),0,1)
 
Upvote 0
In that case check that your dates are real dates. If you change the format of all the date cells to general do you still see dates?
yes i tried that and they showed as the number formats. Ive just posted a formula I think is working, what do you think?
 
Upvote 0
That formula does not give the same results as post#13 which you said was correct.
 
Upvote 0

Forum statistics

Threads
1,223,237
Messages
6,170,928
Members
452,366
Latest member
TePunaBloke

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