felixstraube
Well-known Member
- Joined
- Nov 27, 2023
- Messages
- 897
- Office Version
- 365
- Platform
- Windows
- Web
Hi there.
I was scratching my head because of a REDUCE function that wouldn't work as expected. And I still can't figure out why. Can you help me?
It doesn't make much sense what the REDUCE function does, because it is not complete, but you'll see my problem.
In column A, I will paste some text. The number of rows may change so I need to get the last row with data, and take or filter only those rows from start to the last with text (d is the filtered data). Then I feed d to the REDUCE function.
In C1, it works fine when I filter the data with TAKE. But the formula in D1, when I use FILTER, REDUCE will throws an #VALUE! error.
Here we can see that the content of d should be the same in both formulas:
But somehow the result of FILTER is different from the one of the TAKE function and REDUCE won't work.
Can you help me understand what is happening here?
I was scratching my head because of a REDUCE function that wouldn't work as expected. And I still can't figure out why. Can you help me?
It doesn't make much sense what the REDUCE function does, because it is not complete, but you'll see my problem.
Book1 | ||||||
---|---|---|---|---|---|---|
A | B | C | D | |||
1 | Text01 | #VALUE! | ||||
2 | Text02 | Text01 | ||||
3 | Text02 | |||||
4 | Text03 | 0 | ||||
5 | Text03 | |||||
6 | Text04 | 0 | ||||
7 | Text05 | Text04 | ||||
8 | Text05 | |||||
9 | Text06 | 0 | ||||
10 | Text07 | Text06 | ||||
11 | Text08 | Text07 | ||||
12 | Text08 | |||||
13 | Text09 | 0 | ||||
14 | Text10 | Text09 | ||||
15 | Text10 | |||||
Sheet1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
C1:C15 | C1 | =LET(t, A1:A100, maxrow, MAX(ROW(t)*(t<>"")), d, TAKE(t, maxrow), s, REDUCE("", d, LAMBDA(ini,x, VSTACK(ini,x))), s ) |
D1 | D1 | =LET(t, A1:A100, maxrow, MAX(ROW(t)*(t<>"")), d, FILTER(t, ROW(t)<=maxrow), s, REDUCE("", d, LAMBDA(ini,x, VSTACK(ini,x))), s ) |
Dynamic array formulas. |
In column A, I will paste some text. The number of rows may change so I need to get the last row with data, and take or filter only those rows from start to the last with text (d is the filtered data). Then I feed d to the REDUCE function.
In C1, it works fine when I filter the data with TAKE. But the formula in D1, when I use FILTER, REDUCE will throws an #VALUE! error.
Here we can see that the content of d should be the same in both formulas:
Book1 | ||||||
---|---|---|---|---|---|---|
A | B | C | D | |||
1 | Text01 | Text01 | Text01 | |||
2 | Text02 | Text02 | Text02 | |||
3 | 0 | 0 | ||||
4 | Text03 | Text03 | Text03 | |||
5 | 0 | 0 | ||||
6 | Text04 | Text04 | Text04 | |||
7 | Text05 | Text05 | Text05 | |||
8 | 0 | 0 | ||||
9 | Text06 | Text06 | Text06 | |||
10 | Text07 | Text07 | Text07 | |||
11 | Text08 | Text08 | Text08 | |||
12 | 0 | 0 | ||||
13 | Text09 | Text09 | Text09 | |||
14 | Text10 | Text10 | Text10 | |||
Sheet1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
C1:C14 | C1 | =LET(t, A1:A100, maxrow, MAX(ROW(t)*(t<>"")), d, TAKE(t, maxrow), s, REDUCE("", d, LAMBDA(ini,x, VSTACK(ini,x))), d ) |
D1:D14 | D1 | =LET(t, A1:A100, maxrow, MAX(ROW(t)*(t<>"")), d, FILTER(t, ROW(t)<=maxrow), s, REDUCE("", d, LAMBDA(ini,x, VSTACK(ini,x))), d ) |
Dynamic array formulas. |
But somehow the result of FILTER is different from the one of the TAKE function and REDUCE won't work.
Can you help me understand what is happening here?