If statements

lionstud31

Board Regular
Joined
Oct 16, 2006
Messages
89
is it possible to do an if statement between two dates? For Example: between jan 3rd 2006 and feb 2nd 2006 would make it true, any other dates would make it false.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Say the date you are interested in is in A1, the jan3rd date is in B1 and the Feb2nd date is in C1 then:

Code:
=AND(A1>=B1,A1<=C1)

Best regards

Richard

EDIT: with IF maybe:

Code:
=IF(AND(A1>=B1,A1<=C1),TRUE,FALSE)

but the IF is unnecessary.
 
Upvote 0
Try to avoid using "statement" when you mean formula...

=AND(A2>=X2,A2<=Y2)

where X2 <= Y2 which are date criteria of interest.
 
Upvote 0
I dont understand... What if I want total sales (which is in column C) only if it is between the dates of Jan 3, 2006 and Feb 2, 2006 (which is in column B).
 
Upvote 0
Say the date you are interested in is in A1, the jan3rd date is in B1 and the Feb2nd date is in C1 then:

Code:
=AND(A1>=B1,A1<=C1)

Best regards

Richard

EDIT: with IF maybe:

Code:
=IF(AND(A1>=B1,A1<=C1),TRUE,FALSE)

but the IF is unnecessary.

Richard has already given you the answer my friend

in his IF option simply replace TRUE with the cell containing the sale in question, replace FALSe with "", et voila all the sales between those dates are filtered out and those outside the limits are turned into nothing....then SUM this column and you have your answer.

You could even have you date limit Cells and entry cells and then you can filter out any dates you want in an instance
 
Upvote 0
I think what you want is something like:

=SUMPRODUCT(--(B1:B1000>=DATE(2006,1,3)),--(B1:B1000<=DATE(2006,2,2)),C1:C1000)

You can use cell references in place of eg DATE(2006,1,3).
 
Upvote 0
LionStud

Do you have a range of sales dates and sales values, and you want to sum those between the given dates? If so, something like this might be more approrpiate:<SPAN id='ForSubmit'>
Book2.xls
ABCD
1DateSales
201January200610
315January200615
401February200620
515February200613
601March200614
715March200616
801April200618
915April200617
10
11Date1:29January2006
12Date2:17March2006
13SalesBetween:63
Sheet1
</SPAN>

Hope this helps!

Richard

EDIT: Man I am soooooooooo slow at times :rolleyes:
 
Upvote 0

Forum statistics

Threads
1,214,790
Messages
6,121,607
Members
449,037
Latest member
Arbind kumar

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