Index Aggregate help

hajiali

Well-known Member
Joined
Sep 8, 2018
Messages
624
Office Version
  1. 2016
Platform
  1. Windows
Hello everyone need some help with the below.

I want to be able to pull all E# that have FHL in Decld Column N and that Leave in column K is not equal to Leave list in column P.

Results in for the example below is in Column R. the formula in column S does what I need however its not effective as if I need to add to my Leave list I have to keep updating the formula. I had plans to make an Dynamic Name range for the List and reference that in my Formula if possible.

any help is greatly appreciated. I'm not restricted to Formula if there is an VBA approach that would be ok.

Book1
IJKLMNOPQRS
1E#FIRST NAMELEAVESTARTSENDSDECLDLEAVE LISTRESULTFormula
2133114KELVINMLA6/15/2212/6/23FHLFMLA133444133444
3133928CRISTOPHERMLA11/15/2212/31/23FHLMLA133560133560
4133444BRIANFHLOJI133683133683
5133560KATEFHLMILL133519133519
6133135NATHANOJI6/30/2312/31/23FHLMILR133632133632
7133683PHILLIPFHLMED/SCK133356133356
8133519LEOSIDA6/20/236/20/23FHLMED133040133040
9133632JOSHUASIDA6/14/236/14/23FHLSUSP-PAID133930133930
10133356DEADERAFHLSUSP-UNPAID133486133486
11133240KIARA FHL6/17/236/18/23FTONH-TRN133741133741
12133040JACOB FHLTERM
13133930LAURENTHTD6/19/2312/31/23FHLTRVL
14133486DASHEANFHLTEMP
15133623CARYRESIGNED6/27/2312/31/23FHLEXPIRED BADGE
16133741JENNIFERFHLTRSFR
17133083JORDANFNL6/17/236/18/23FTORESIGNED
18133314THOMASOJI3/24/237/25/23FTONH-TRN-DAL
19133065BRADLEYNH-TRN-DAL6/19/239/7/23FHLNH-TRN
20133527MATTNH-TRN-DAL6/19/239/7/23FHL
21133750TIMNH-TRN7/10/239/27/23FHL
22133483PAUL NH-TRN7/10/239/27/23FTO
23133559ANTHONYNH-TRN7/10/239/27/23FHL
Sheet1
Cell Formulas
RangeFormula
S2:S11S2=INDEX($I$2:$I$23,AGGREGATE(15,6,(ROW($I$2:$I$23)-ROW($I$2)+1)/(($N$2:$N$23="FHL")*($K$2:$K$23<>$P$3)*($K$2:$K$23<>$P$4)*($K$2:$K$23<>$P$5)*($K$2:$K$23<>$P$6)*($K$2:$K$23<>$P$7)*($K$2:$K$23<>$P$8)*($K$2:$K$23<>$P$9)*($K$2:$K$23<>$P$10)*($K$2:$K$23<>$P$11)*($K$2:$K$23<>$P$12)*($K$2:$K$23<>$P$13)*($K$2:$K$23<>$P$14)*($K$2:$K$23<>$P$15)*($K$2:$K$23<>$P$16)*($K$2:$K$23<>$P$17)*($K$2:$K$23<>$P$18)*($K$2:$K$23<>$P$19)*($K$2:$K$23<>$P$2)),ROWS($S$2:S2)))
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
You can still use a formula and dynamic named range to return the desired result. First either convert the range for your leave list into a Table or create a dynamic named range. Then try the following...

Book2
IJKLMNOPQRS
1E#FIRST NAMELEAVESTARTSENDSDECLDLEAVE LISTRESULTFormula
2133114KELVINMLA4472745266FHLFMLA133444133444
3133928CRISTOPHERMLA4488045291FHLMLA133560133560
4133444BRIANFHLOJI133683133683
5133560KATEFHLMILL133519133519
6133135NATHANOJI4510745291FHLMILR133632133632
7133683PHILLIPFHLMED/SCK133356133356
8133519LEOSIDA4509745097FHLMED133040133040
9133632JOSHUASIDA4509145091FHLSUSP-PAID133930133930
10133356DEADERAFHLSUSP-UNPAID133486133486
11133240KIARA FHL4509445095FTONH-TRN133741133741
12133040JACOB FHLTERM
13133930LAURENTHTD4509645291FHLTRVL
14133486DASHEANFHLTEMP
15133623CARYRESIGNED4510445291FHLEXPIRED BADGE
16133741JENNIFERFHLTRSFR
17133083JORDANFNL4509445095FTORESIGNED
18133314THOMASOJI4500945132FTONH-TRN-DAL
19133065BRADLEYNH-TRN-DAL4509645176FHLNH-TRN
20133527MATTNH-TRN-DAL4509645176FHL
21133750TIMNH-TRN4511745196FHL
22133483PAUL NH-TRN4511745196FTO
23133559ANTHONYNH-TRN4511745196FHL
Sheet1
Cell Formulas
RangeFormula
S2:S11S2=INDEX($I$2:$I$23,AGGREGATE(15,6,(ROW($I$2:$I$23)-ROW($I$2)+1)/(($N$2:$N$23="FHL")*(ISNA(MATCH($K$2:$K$23,LeaveList,0)))),ROWS($S$2:S2)))
Named Ranges
NameRefers ToCells
LeaveList=Sheet1!$P$2:INDEX(Sheet1!$P:$P,MATCH("z",Sheet1!$P:$P))S2:S11


Hope this helps!
 
Upvote 0
Solution

Forum statistics

Threads
1,215,440
Messages
6,124,882
Members
449,193
Latest member
PurplePlop

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