Return value if date is between today and today+180

RockFish74

New Member
Joined
Aug 31, 2017
Messages
19
Hello,

I am struggling with a function that returns a quantity (value) if the expiry date falls between today and today+180 days. I would prefer not to use IF(AND)... if possible.

For example ... today's date is 2/6/2020 and 30 units expire on 6/14/2020 (within today+180) then 30 should be returned. If the 30 units expire on 9/12/2020 (falls outside of today + 180), then return a blank. Blanks should be returned if the date is less than today.

Any assistance is greatly appreciated!
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
I am struggling with a function that returns a quantity (value) if the expiry date falls between today and today+180 days. I would prefer not to use IF(AND)... if possible.
Why? That is pretty much how you would do it!

If the date is in cell A2, then the formula might look something like:
=IF(A2>0,IF(AND(A2>=TODAY(),A2<=(TODAY()+180)),30,0),0)
 
Upvote 0
It's not clear what sort of dataset you are trying to retrieve the number(s) from but maybe use something like below ?

Book1
ABCD
1ExpiringUnitsExpire
2531011/09/2020
32012/09/2020
4>3014/02/2020
54013/09/2020
69914/09/2020
76015/09/2020
87016/09/2020
98017/09/2020
109018/09/2020
1110019/09/2020
122220/09/2020
131421/09/2020
1413022/09/2020
1514023/09/2020
16>2314/02/2020
176625/09/2020
1817026/09/2020
1918027/09/2020
2019028/09/2020
Sheet5
Cell Formulas
RangeFormula
A2A2=SUMPRODUCT(C2:C20*(D2:D20<=(TODAY()+180)))


Hope that helps.
 
Upvote 0
It's not clear what sort of dataset you are trying to retrieve the number(s) from but maybe use something like below ?

Book1
ABCD
1ExpiringUnitsExpire
2531011/09/2020
32012/09/2020
4>3014/02/2020
54013/09/2020
69914/09/2020
76015/09/2020
87016/09/2020
98017/09/2020
109018/09/2020
1110019/09/2020
122220/09/2020
131421/09/2020
1413022/09/2020
1514023/09/2020
16>2314/02/2020
176625/09/2020
1817026/09/2020
1918027/09/2020
2019028/09/2020
Sheet5
Cell Formulas
RangeFormula
A2A2=SUMPRODUCT(C2:C20*(D2:D20<=(TODAY()+180)))


Hope that helps.

Thank you for the help!
 
Upvote 0
You are welcome.
 
Upvote 0

Forum statistics

Threads
1,215,444
Messages
6,124,893
Members
449,194
Latest member
JayEggleton

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