Hướng dẫn vstack in excel

Excel cho Microsoft 365 Excel cho Microsoft 365 dành cho máy Mac Excel cho web Xem thêm...Ít hơn

Nối các mảng theo chiều dọc và theo trình tự để trả về một mảng lớn hơn.

Cú pháp

=VSTACK[array1,[array2],...]

Cú pháp hàm VSTACK có đối số sau đây:

mảng    Các mảng cần nối thêm.

Chú thích

VSTACK trả về mảng được hình thành bằng cách nối thêm từng đối số mảng theo hàng. Mảng nhận được sẽ có các kích thước sau đây:

  • Hàng: tổng số lượng tất cả các hàng từ mỗi đối số mảng.

  • Cột: Số cột tối đa từ mỗi đối số mảng.

Lỗi

Nếu mảng có ít cột hơn độ rộng tối đa của các mảng đã chọn, Excel trả về lỗi #N/A trong các cột bổ sung. Sử dụng VSTACK bên trong hàm IFERROR để thay thế #N/A bằng giá trị mà bạn chọn.

Ví dụ

Sao chép dữ liệu ví dụ trong bảng sau đây và dán vào ô A1 của một bảng tính Excel mới. Nếu cần, bạn có thể điều chỉnh độ rộng cột để xem toàn bộ dữ liệu.

Nối theo chiều dọc hai mảng đơn giản theo trình tự để có kết quả là một mảng.

Dữ liệu

A

B

C

AA

BB

CC

D

E

F

DD

EE

FF

Công thức

=VSTACK[A2:C3,E2:G3]

Nối theo chiều dọc ba mảng theo trình tự để có kết quả là một mảng gồm hai cột và sáu hàng.

Dữ liệu

1

2

A

B

X

y

3

4

C

D

5

6

Công thức

=VSTACK[A2:B4,C2:D3,E2:F2]

Nối theo chiều dọc ba mảng theo trình tự để có kết quả là một mảng gồm ba cột và sáu hàng với lỗi #N/A để điền các phần tử mảng trống.

Dữ liệu

1

2

A

B

C

#VALUE!

3

4

D

E

F

5

6

Công thức

=VSTACK[A2:B4,C2:E3,F2]

Xem thêm

Hướng dẫn và ví dụ về công thức mảng

Hàm HSTACK

Hàm CHOOSEROWS

Hàm CHOOSECOLS

Cần thêm trợ giúp?

Excel for Microsoft 365 Excel for Microsoft 365 for Mac Excel for the web More...Less

Appends arrays vertically and in sequence to return a larger array.

Syntax

=VSTACK[array1,[array2],...]

The VSTACK function syntax has the following argument:

array    The arrays to append.

Remarks

VSTACK returns the array formed by appending each of the array arguments in a row-wise fashion. The resulting array will be the following dimensions:

  • Rows: the combined count of all the rows from each of the array arguments.

  • Columns: The maximum of the column count from each of the array arguments.

Errors

If an array has fewer columns than the maximum width of the selected arrays, Excel returns a #N/A error in the additional columns. Use VSTACK inside the IFERROR function to replace #N/A with the value of your choice.

Examples

Copy the example data in the following table and paste it in cell A1 of a new Excel worksheet. If you need to, you can adjust the column widths to see all the data.

Vertically appends two simple arrays in sequence so that the results are one array.

Data

A

B

C

AA

BB

CC

D

E

F

DD

EE

FF

Formula

=VSTACK[A2:C3,E2:G3]

Vertically appends three arrays in sequence so that the results are one array of two columns and six rows.

Data

1

2

A

B

X

Y

3

4

C

D

5

6

Formulas

=VSTACK[A2:B4,C2:D3,E2:F2]

Vertically appends three arrays in sequence so that the results are one array of three columns and six rows with a #N/A error to fill in empty array elements.

Data

1

2

A

B

C

#VALUE!

3

4

D

E

F

5

6

Formulas

=VSTACK[A2:B4,C2:E3,F2]

See Also

Guidelines and examples of array formulas

HSTACK function

CHOOSEROWS function

CHOOSECOLS function

Need more help?

Chủ Đề