Monday, 27 January 2025

more dynamic array functions

 Dynamic array functions in Excel are powerful tools that allow you to work with arrays of data more efficiently. Below are 20 examples of dynamic array functions, each including sample data and explanations. These functions include SORT, FILTER, UNIQUE, SEQUENCE, RANDARRAY, XLOOKUP, and more.


1. SORT Function

Sorts a range or array in ascending or descending order.

Data:

AB
10X
30Y
20Z

Formula:

excel
Copy
=SORT(A1:B3, 1, 1)

Result:
| 10 | X |
| 20 | Z |
| 30 | Y |


2. SORTBY Function

Sorts a range based on another range or array.

Data:

AB
10X
30Y
20Z

Formula:

excel
Copy
=SORTBY(A1:B3, B1:B3, 1)

Result:
| 10 | X |
| 30 | Y |
| 20 | Z |


3. FILTER Function

Filters a range based on criteria.

Data:

AB
10X
30Y
20Z

Formula:

excel
Copy
=FILTER(A1:B3, A1:A3 > 15)

Result:
| 30 | Y |
| 20 | Z |


4. UNIQUE Function

Extracts unique values from a range.

Data:

A
10
20
10
30

Formula:

excel
Copy
=UNIQUE(A1:A4)

Result:
| 10 |
| 20 |
| 30 |


5. SEQUENCE Function

Generates a sequence of numbers.

Formula:

excel
Copy
=SEQUENCE(5)

Result:
| 1 |
| 2 |
| 3 |
| 4 |
| 5 |


6. RANDARRAY Function

Generates an array of random numbers.

Formula:

excel
Copy
=RANDARRAY(3, 2)

Result:
| 0.12 | 0.45 |
| 0.67 | 0.89 |
| 0.34 | 0.56 |


7. XLOOKUP Function

Looks up a value in a range and returns a corresponding value.

Data:

AB
10X
20Y
30Z

Formula:

excel
Copy
=XLOOKUP(20, A1:A3, B1:B3)

Result:
| Y |


8. TRANSPOSE Function

Transposes a range (rows to columns or vice versa).

Data:

AB
1020
3040

Formula:

excel
Copy
=TRANSPOSE(A1:B2)

Result:
| 10 | 30 |
| 20 | 40 |


9. SORT and FILTER Combined

Sorts and filters data simultaneously.

Data:

AB
10X
30Y
20Z

Formula:

excel
Copy
=SORT(FILTER(A1:B3, A1:A3 > 15), 1, 1)

Result:
| 20 | Z |
| 30 | Y |


10. UNIQUE and SORT Combined

Extracts unique values and sorts them.

Data:

A
10
20
10
30

Formula:

excel
Copy
=SORT(UNIQUE(A1:A4))

Result:
| 10 |
| 20 |
| 30 |


11. SEQUENCE for Dates

Generates a sequence of dates.

Formula:

excel
Copy
=SEQUENCE(5, 1, DATE(2023, 10, 1), 1)

Result:
| 10/1/2023 |
| 10/2/2023 |
| 10/3/2023 |
| 10/4/2023 |
| 10/5/2023 |


12. FILTER with Multiple Criteria

Filters data based on multiple conditions.

Data:

AB
10X
30Y
20Z

Formula:

excel
Copy
=FILTER(A1:B3, (A1:A3 > 15) * (B1:B3 = "Y"))

Result:
| 30 | Y |


13. UNIQUE with Text Data

Extracts unique text values.

Data:

A
X
Y
X
Z

Formula:

excel
Copy
=UNIQUE(A1:A4)

Result:
| X |
| Y |
| Z |


14. RANDARRAY for Random Integers

Generates random integers.

Formula:

excel
Copy
=RANDARRAY(3, 2, 1, 100, TRUE)

Result:
| 45 | 67 |
| 12 | 89 |
| 34 | 56 |


15. XLOOKUP with Wildcard

Looks up a value using a wildcard.

Data:

AB
Apple10
Banana20
Cherry30

Formula:

excel
Copy
=XLOOKUP("Ban*", A1:A3, B1:B3)

Result:
| 20 |


16. TRANSPOSE with SEQUENCE

Transposes a sequence of numbers.

Formula:

excel
Copy
=TRANSPOSE(SEQUENCE(1, 5))

Result:
| 1 | 2 | 3 | 4 | 5 |


17. FILTER with OR Logic

Filters data using OR logic.

Data:

AB
10X
30Y
20Z

Formula:

excel
Copy
=FILTER(A1:B3, (A1:A3 = 10) + (B1:B3 = "Z"))

Result:
| 10 | X |
| 20 | Z |


18. UNIQUE with SORTBY

Extracts unique values and sorts by another column.

Data:

AB
10X
20Z
10Y

Formula:

excel
Copy
=SORTBY(UNIQUE(A1:A3), B1:B3, 1)

Result:
| 10 |
| 20 |


19. SEQUENCE for Matrix

Generates a matrix of numbers.

Formula:

excel
Copy
=SEQUENCE(3, 3)

Result:
| 1 | 2 | 3 |
| 4 | 5 | 6 |
| 7 | 8 | 9 |


20. XLOOKUP with Multiple Results

Returns multiple results for a lookup.

Data:

AB
Apple10
Banana20
Apple30

Formula:

excel
Copy
=XLOOKUP("Apple", A1:A3, B1:B3, "", 0, 1)

Result:
| 10 |
| 30 |


These examples demonstrate the versatility of dynamic array functions in Excel. Let me know if you'd like further clarification or additional examples!

No comments:

Post a Comment