schardt679
Board Regular
- Joined
- Mar 27, 2021
- Messages
- 58
- Office Version
- 365
- 2010
- Platform
- Windows
- Mobile
- Web
Checks if an array is one dimensional and returns "H", "V", or an error message.
Horizontal arrays (across columns) return "H", vertical arrays (down rows) return "V", and 2D arrays return a "One row/column" message.
Calls CELLCOUNT
Horizontal arrays (across columns) return "H", vertical arrays (down rows) return "V", and 2D arrays return a "One row/column" message.
Calls CELLCOUNT
Excel Formula:
=LAMBDA(Array,
LET(Arr, Array, RowCt, CELLCOUNT(Arr, 1), ColCt, CELLCOUNT(Arr, 2), Horiz?, ColCt>RowCt,
ArrScan, AND(RowCt>1, ColCt>1), ArrMSG, "One row/column",
Result, IF(Horiz?, "H", "V"), Return, IF(ArrScan, ArrMSG, Result),
Return)
)
REVERSE Test.xlsx | ||||||||
---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | |||
1 | AONEDIM | |||||||
2 | Checks if an array is one dimensional (horizontal or vertical) | |||||||
3 | 2D arrays return error message | |||||||
4 | 1D arrays return "H" for horizontal {1,2,3} & "V" for vertical {1;2;3} | |||||||
5 | Used in many other functions to ensure correct syntax | |||||||
6 | ||||||||
7 | Original Data | Result | ||||||
8 | Hello | There! | One row/column | |||||
9 | My Name Patrick | I am 27. | ||||||
10 | ||||||||
11 | Data array is 2D --> error message is returned | |||||||
12 | =AONEDIM(B8:C9) | |||||||
13 | ||||||||
14 | ||||||||
15 | ||||||||
16 | Original Data | Result | ||||||
17 | Hello | V | ||||||
18 | There! | |||||||
19 | My Name Patrick | |||||||
20 | I am 27. | |||||||
21 | ||||||||
22 | Data array is 1D --> "V" is returned | |||||||
23 | =AONEDIM(B17:B20) | |||||||
24 | ||||||||
25 | ||||||||
26 | ||||||||
27 | Original Data | |||||||
28 | Hello | There! | My Name Patrick | I am 27. | ||||
29 | ||||||||
30 | Result | |||||||
31 | H | |||||||
32 | ||||||||
33 | Data array is 1D --> "H" is returned | |||||||
34 | =AONEDIM(B28:E28) | |||||||
35 | ||||||||
AONEDIM |
Cell Formulas | ||
---|---|---|
Range | Formula | |
E8 | E8 | =AONEDIM(B8:C9) |
B12 | B12 | =FORMULATEXT(E8) |
E17 | E17 | =AONEDIM(B17:B20) |
B23 | B23 | =FORMULATEXT(E17) |
B31 | B31 | =AONEDIM(B28:E28) |
B34 | B34 | =FORMULATEXT(B31) |
Upvote
0