LET function

Peter Davison

Active Member
Joined
Jun 4, 2020
Messages
435
Office Version
  1. 365
Platform
  1. Windows
I have this formula currently
=LET(a,$DW$13:$DW$1000,b,$EI$13:$EI$1000,ra,ROWS(a),s,SEQUENCE(ra+ROWS(b)),I,IF(s<=ra,INDEX(a,s),INDEX(b,s-ra)),UNIQUE(FILTER(I,I<>0)))

I want to add a third range so I can filter on the range
My third range is - $EH$13:$EH$1000 which I can call c
and I want to filter this range on
c="Ambient"

I tried the following but get an error and I believe I don't have the syntax right in the middle somewhere (I think I need to do something on Rows and Sequence but not sure)
=LET(a,$DW$13:$DW$1000,b,$EI$13:$EI$1000,c,$EH$13:$EH$1000,ra,ROWS(a),s,SEQUENCE(ra+ROWS(b)),I,IF(s<=ra,INDEX(a,s),INDEX(b,s-ra)),UNIQUE(FILTER(I,(I<>0)*(c="Ambient"))))

It you are able to help that would be great
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
=LET(a,$DW$13:$DW$1000,b,$EI$13:$EI$1000,c,$EH$13:$EH$1000,ra,ROWS(a),s,SEQUENCE(ra+ROWS(b)),I,IF(s<=ra,INDEX(a,s),INDEX(b,s-ra)),UNIQUE(FILTER(I, (I<>0) * (c="Ambient"))))
 
Upvote 0
So you are trying to stack two columns? If so, the c variable is of a completely different range (not the same height) which is a requirement for the `FILTER()` function. For example: if values x and y are in variable a, and the values v and w in variable b, these would stack to 4 values while your variable c only holds 2 >> error.

What exactly do you wish to happen with the 3rd variable? Should avoid both values in variable a and b to be included if not 'Ambient'?

Book1
ABCDE
1acambienta
2bftestc
3cgambientg
4dhtest
Sheet1
Cell Formulas
RangeFormula
E1:E3E1=UNIQUE(TOCOL(FILTER(HSTACK(A1:A4,B1:B4),C1:C4="Ambient")))
Dynamic array formulas.
 
Upvote 0
How about
Excel Formula:
=LET(a,VSTACK($DW$13:$DW$1000,$EI$13:$EI$1000),UNIQUE(VSTACK(FILTER(a,a<>0),FILTER($EH$13:$EH$1000,$EH$13:$EH$1000="Ambient"))))
 
Upvote 1
Solution
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,872
Messages
6,122,025
Members
449,060
Latest member
LinusJE

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