Based on Dates, how to know the discount if Yes or No column?

jamiguel77

Active Member
Joined
Feb 14, 2006
Messages
378
Office Version
  1. 2016
  2. 2010
  3. 2007
Platform
  1. Windows
  2. Web
Based on Dates, how to know the discount if Yes or No column?

DesdeHastaYesNo
27/02/201126/02/201313%10%
26/02/201326/02/201511%8%
26/02/201525/02/20179%7%
25/02/201725/02/20197%4%
25/02/2019more…1%2%
15/03/2016Yes
05/04/2014No
24/04/2012No
11/05/2019Yes
15/04/2012No



the first cell(C11) would be the answer 9%


thanks
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
As long as there is no overlap with the date ranges. If the date is an exact match then it will return the percentage that starts on that date, not the one that ends. For example, 26/02/2013 will return 11% for Yes, not 13% (although technically, both are correct based on the table).

It would be better to either decrease the dates in column B by 1 day, or increase those in column A by 1 day so that they don't clash.
Book1
ABCD
3DesdeHastaYesNo
427-Feb-1126-Feb-1313%10%
526-Feb-1326-Feb-1511%8%
626-Feb-1525-Feb-179%7%
725-Feb-1725-Feb-197%4%
825-Feb-1903-Jun-211%2%
9
10
1115-Mar-16Yes9%
1205-Apr-14No8%
1324-Apr-12No10%
1411-May-19Yes1%
1515-Apr-12No10%
Sheet2
Cell Formulas
RangeFormula
C11:C15C11=SUMIFS(IF(B11="Yes",$C$4:$C$8,$D$4:$D$8),$A$4:$A$8,"<="&A11,$B$4:$B$8,">"&A11)
 
Upvote 0
Solution
I wrote a slightly different formula after adjusting my test data for US dates:

Book6
ABCDEFGHI
3DesdeHastaYesNoYesNo
427/02/201126/02/201313%10%2/27/20112/26/201313%10%
526/02/201326/02/201511%8%2/27/20132/26/201511%8%
626/02/201525/02/20179%7%2/27/20152/25/20179%7%
725/02/201725/02/20197%4%2/26/20172/25/20197%4%
825/02/2019more…1%2%2/26/20192/25/20211%2%
9
10PERCENT
1115/03/2016Yes3/15/2016Yes9%
1205/04/2014No4/5/2014No8%
1324/04/2012No4/24/2012No10%
1411/05/2019Yes5/11/2019Yes1%
1515/04/2012No4/15/2012No10%
Sheet4
Cell Formulas
RangeFormula
H11:H15H11=INDEX($H$4:$I$8,MATCH(F11,$F$4:$F$8),CHOOSE(1+("No"=G11),1,2))
 
Upvote 0

Forum statistics

Threads
1,214,389
Messages
6,119,232
Members
448,879
Latest member
VanGirl

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