Faster formula than this ?

ste33uka

Active Member
Joined
Jan 31, 2020
Messages
473
Office Version
  1. 365
Platform
  1. Windows
I have hundreds of formulas like this per sheet that finds 1st,2nd,3rd,4th last occurance, is there any faster formulas ?
Thanks

=IF(F4<>"",IFERROR(INDEX($AY$204296:$AY$525555,AGGREGATE(14,6,ROW($D$1:$D$525555)/($AW$204296:$AW$525555=F5)/($AA$204296:$AA$525555=F6),1)),""),"")

=IF(F4<>"",IFERROR(INDEX($AY$204296:$AY$525555,AGGREGATE(14,6,ROW($D$1:$D$525555)/($AW$204296:$AW$525555=F5)/($AA$204296:$AA$525555=F6),2)),""),"")

=IF(F4<>"",IFERROR(INDEX($AY$204296:$AY$525555,AGGREGATE(14,6,ROW($D$1:$D$525555)/($AW$204296:$AW$525555=F5)/($AA$204296:$AA$525555=F6),3)),""),"")

=IF(F4<>"",IFERROR(INDEX($AY$204296:$AY$525555,AGGREGATE(14,6,ROW($D$1:$D$525555)/($AW$204296:$AW$525555=F5)/($AA$204296:$AA$525555=F6),4)),""),"")
 
Just reconfiguring post #8 to fit your data seems to work for me:
Excel Formula:
=CHOOSECOLS(SORT(FILTER(HSTACK(B4:B11,SEQUENCE(COUNTA(B4:B11))),F1&F2=C4:C11&D4:D11),2,-1),1)

Or using the multiply rather than concatenate method:
Excel Formula:
=CHOOSECOLS(SORT(FILTER(HSTACK(B4:B11,SEQUENCE(COUNTA(B4:B11))),(C4:C11=F1)*(D4:D11=F2)),2,-1),1)
strange when i use that formula i get #name?
Book2.xlsx
ABCDEFGHIJK
1red#NAME?#NAME?
2blue
3
467redblue
599redblue
6712
72
86redblue
97
108
1118
12
13
14
15
16
17
18
19
Sheet1
Cell Formulas
RangeFormula
J1J1=CHOOSECOLS(SORT(FILTER(HSTACK(B4:B11,SEQUENCE(COUNTA(B4:B11))),F1&F2=C4:C11&D4:D11),2,-1),1)
K1K1=CHOOSECOLS(SORT(FILTER(HSTACK(B4:B11,SEQUENCE(COUNTA(B4:B11))),(C4:C11=F1)*(D4:D11=F2)),2,-1),1)
A4A4=IF(F1<>"",IFERROR(INDEX($B$1:$B$20,AGGREGATE(14,6,ROW($B$1:$B$20)/($C$1:$C$20=F1)/($D$1:$D$20=F2),1)),""),"")
A5A5=IF(F1<>"",IFERROR(INDEX($B$1:$B$20,AGGREGATE(14,6,ROW($B$1:$B$20)/($C$1:$C$20=F1)/($D$1:$D$20=F2),2)),""),"")
A6A6=IF(F1<>"",IFERROR(INDEX($B$1:$B$20,AGGREGATE(14,6,ROW($B$1:$B$20)/($C$1:$C$20=F1)/($D$1:$D$20=F2),3)),""),"")
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
I think ChooseCols might be one of the later functions, if you type =ChooseCols does Excel recognise it ?
If it does how about =HStack ?
You are definitely using MS 365 right ?
 
Upvote 0
I think ChooseCols might be one of the later functions, if you type =ChooseCols does Excel recognise it ?
If it does how about =HStack ?
You are definitely using MS 365 right ?

Book2.xlsx
ABCDEF
1
2
3
4#NAME?
5#NAME?
6
7
8
9
10
11
12
13
14
15
16
Sheet2
Cell Formulas
RangeFormula
A4A4=CHOOSECOLS
A5A5=HSTACK



Says version 2203 build 15028.20228
 
Upvote 0
If you have a personal subscription you might want to update your software.
If you are in an organisation, that is a long way behind for even the biannual cycle that a lot of companies seem to be on and you might want to ask the question.
I think HStack and ChooseCols have been around since Mar 2022 and the release note list on the below only goes back to vrs 2206 Jul 2022

The ChooseCols can be replaced with the Index function, not sure how to get around the HStack function.
 
Upvote 0
If you have a personal subscription you might want to update your software.
If you are in an organisation, that is a long way behind for even the biannual cycle that a lot of companies seem to be on and you might want to ask the question.
I think HStack and ChooseCols have been around since Mar 2022 and the release note list on the below only goes back to vrs 2206 Jul 2022

The ChooseCols can be replaced with the Index function, not sure how to get around the HStack function.
im not in an organisation
Thanks for help, ill have to look into it
 
Upvote 0
How about
Excel Formula:
=LET(f,FILTER($AY$204296:$AY$525555,($AW$204296:$AW$525555=F5)*($AA$204296:$AA$525555=F6)),INDEX(f,SEQUENCE(4,,ROWS(f),-1)))
 
Upvote 0
How about
Excel Formula:
=LET(f,FILTER($AY$204296:$AY$525555,($AW$204296:$AW$525555=F5)*($AA$204296:$AA$525555=F6)),INDEX(f,SEQUENCE(4,,ROWS(f),-1)))
Hi fluff, just returns #calc!
edit thanks alot fluff that works, is there anyway that result would go accross the row instead of down ?
 
Upvote 0
How about
Excel Formula:
=LET(f,FILTER($AY$204296:$AY$525555,($AW$204296:$AW$525555=F5)*($AA$204296:$AA$525555=F6)),INDEX(f,SEQUENCE(MIN(4,ROWS(f)),,ROWS(f),-1)))
 
Upvote 1
Solution
How about
Excel Formula:
=LET(f,FILTER($AY$204296:$AY$525555,($AW$204296:$AW$525555=F5)*($AA$204296:$AA$525555=F6)),INDEX(f,SEQUENCE(MIN(4,ROWS(f)),,ROWS(f),-1)))
is there anyway that result would go accross the row instead of down ?
edit
sorted
Excel Formula:
=TRANSPOSE(LET(f,FILTER($B$1:$B$22,($C$1:$C$22=F1)*($D$1:$D$22=F2)),INDEX(f,SEQUENCE(5,,ROWS(f),-1))))
Excel Formula:

Thanks alot fluff for your help
 
Last edited:
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,853
Messages
6,181,410
Members
453,038
Latest member
muhsen

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