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

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
Joined
Apr 19, 2005
Messages
23,707
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
Joined
Jul 21, 2002
Messages
73,092
See if you can adapt this:

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

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,209
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
Joined
Oct 16, 2006
Messages
89

ADVERTISEMENT

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
Joined
Oct 16, 2006
Messages
9
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
 

lionstud31

Board Regular
Joined
Oct 16, 2006
Messages
89

ADVERTISEMENT

thanks yall, problem solved
 

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
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
Joined
Apr 19, 2005
Messages
23,707
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:
 

Forum statistics

Threads
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.
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
Top