# If statements

#### lionstud31

##### Board Regular
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

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

#### Richard Schollar

##### MrExcel MVP
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.

#### Andrew Poulsom

##### MrExcel MVP
See if you can adapt this:

Code:
``=AND(DATE(2006,1,15)>=DATE(2006,1,3),DATE(2006,1,15)<=DATE(2006,2,2))``

##### MrExcel MVP
Try to avoid using "statement" when you mean formula...

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

where X2 <= Y2 which are date criteria of interest.

#### lionstud31

##### Board Regular

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).

#### buckley22

##### New Member
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.

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

#### lionstud31

##### Board Regular

thanks yall, problem solved

#### Andrew Poulsom

##### MrExcel MVP
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).

#### Richard Schollar

##### MrExcel MVP
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

Replies
3
Views
774
Replies
5
Views
286
Replies
9
Views
468
Replies
11
Views
432
Replies
7
Views
252

1,136,309
Messages
5,674,996
Members
419,541
Latest member
freddyboots

### 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.

### Which adblocker are you using?

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

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