Dynamic range with Choose and match

okvals48

New Member
Joined
Sep 27, 2020
Messages
15
Office Version
  1. 365
Platform
  1. Windows
Hi,

i have created daynamic range in my formula using Choose and Match, and i was wondering is there maybe a better aproach then one I have implemented.

+LOOKUP(1E+307;1/(($C17=$K$4:$K$24)*($D17>=$L$4:$L$24)*($D17<=$M$4:$M$24))*CHOOSE(MATCH(H$15;$N$3:$Q$3);$N$4:$N$24;$O$4:$O$24;$P$4:$P$24;$Q$4:$Q$24))
With match i get relative number to which my search is related to, so choose knows in what column he should look for data.

One question how can i refine this, and i have a problem because match does not match headers in tables but when I insert numbers for example 1 to 4 everything works normaly.

Thanks in advance

Automatic discount update based on time period.xlsx
CDEFGHIJKLMNOPQ
3CustomerDate purchasedDiscount CustomerStartEndDISCOUNTREBATEOFF REBATEDATA EX
4310.7.20162,0015.1.20165.11.201628154
5411.7.2016211.1.20171.11.201728154
6512.7.2016226.1.20166.11.201628154
7610.10.2016222.1.20172.11.201728154
878.10.2016237.1.20167.9.201628154
988.12.2016No disocunt for this period33.1.20173.11.201728154
1096.3.2017248.1.20168.11.201628154
1191.6.2017244.1.20174.11.201728154
12715.10.2017259.1.20169.11.201628154
1355.1.20175.11.201728154
14610.1.201610.11.201628154
15CUSTOMERDATE PURCHASEDDISCOUNTREBATEOFF REBATEDATA EX66.1.20176.11.201728154
16310.7.2016282#N/A71.1.201631.12.201628154
17411.7.2016282#N/A71.1.201731.12.201728154
18512.7.2016282#N/A812.1.201612.11.201628154
19610.10.2016282#N/A82.1.20172.11.201728154
2078.10.2016282#N/A91.1.201730.5.201728154
2188.12.2016#N/A#N/A#N/A#N/A91.6.20173.11.201728154
2296.3.2017282#N/A102.1.20172.11.201728154
2391.6.2017282#N/A103.11.201731.12.201728154
24715.10.2017282#N/A117.1.20167.11.201628154
25102.11.2017282#N/A
26117.1.2016282#N/A
3
Cell Formulas
RangeFormula
E4:E8,E10:E12E4=+IFERROR(LOOKUP(1E+307,1/((C4=K4:K24)*(D4>=L4:L24)*(D4<=M4:M24))*N4:N24),"No disocuntfor this period")
E9E9=+IFERROR(LOOKUP(1E+307,1/((C9=K9:K29)*(D9>=L9:L29)*(D9<=M9:M29))*N9:N29),"No disocunt for this period")
E16:H26E16=+LOOKUP(1E+307,1/(($C16=$K$4:$K$24)*($D16>=$L$4:$L$24)*($D16<=$M$4:$M$24))*CHOOSE(MATCH(E$15,$N$3:$Q$3),$N$4:$N$24,$O$4:$O$24,$P$4:$P$24,$Q$4:$Q$24))
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Your match function is doing an approximate match, it should be
Excel Formula:
MATCH(E$15,$N$3:$Q$3,0)
 
Upvote 0
As you have xl365, you could also use
+Fluff 1.xlsm
CDEFGHIJKLMNOPQ
3CustomerDate purchasedDiscount CustomerStartEndDISCOUNTREBATEOFF REBATEDATA EX
4310/07/20162105/01/201605/11/201628154
5411/07/20162101/01/201701/11/201728154
6512/07/20162206/01/201606/11/201628154
7610/10/20162202/01/201702/11/201728154
8708/10/20162307/01/201607/09/201628154
9808/12/2016No disocunt for this period303/01/201703/11/201728154
10906/03/20172408/01/201608/11/201628154
11901/06/20172404/01/201704/11/201728154
12715/10/20172509/01/201609/11/201628154
13505/01/201705/11/201728154
14610/01/201610/11/201628154
15CUSTOMERDATE PURCHASEDDISCOUNTREBATEOFF REBATEDATA EX606/01/201706/11/201728154
16310/07/201628154701/01/201631/12/201628154
17411/07/201628154701/01/201731/12/201728154
18512/07/201628154812/01/201612/11/201628154
19610/10/201628154802/01/201702/11/201728154
20708/10/201628154901/01/201730/05/201728154
21808/12/2016No Match901/06/201703/11/201728154
22906/03/2017281541002/01/201702/11/201728154
23901/06/2017281541003/11/201731/12/201728154
24715/10/2017281541107/01/201607/11/201628154
251002/11/201728154
261107/01/201628154
Data
Cell Formulas
RangeFormula
E4:E8,E10:E12E4=+IFERROR(LOOKUP(1E+307,1/((C4=K4:K24)*(D4>=L4:L24)*(D4<=M4:M24))*N4:N24),"No disocuntfor this period")
E9E9=+IFERROR(LOOKUP(1E+307,1/((C9=K9:K29)*(D9>=L9:L29)*(D9<=M9:M29))*N9:N29),"No disocunt for this period")
E22:H26,E21,E16:H20E16=FILTER(FILTER($N$4:$Q$24,($C16=$K$4:$K$24)*($D16>=$L$4:$L$24)*($D16<=$M$4:$M$24),"No Match"),MATCH(E$15,$N$3:$Q$3,0),"No match")
Dynamic array formulas.
 
Upvote 0
Solution
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,787
Messages
6,121,561
Members
449,038
Latest member
Guest1337

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