ID EN
#Dynamic array

TRIMRANGE

Excel Functions 🇮🇩 Bahasa Indonesia

Hapus baris dan kolom kosong dari suatu rentang

Syntax

EXCEL
=TRIMRANGE(range, [trim_rows], [trim_columns])

Arguments

Parameter Deskripsi
range The range or array to be trimmed.
trim_rows [optional] How rows should be trimmed. 0 = none, 1 = trim leading, 2 = trim trailing, 3 = trim leading and trailing (default).
trim_columns [optional] How columns should be trimmed. 0 = none, 1 = trim leading, 2 = trim trailing, 3 = trim leading and trailing (default).

Return Value

Rentang yang dipangkas

Details

Fungsi TRIMRANGE menghilangkan baris dan kolom kosong dari tepi luar rentang data. Mengingat rentang atau larik, ini akan mengecualikan baris dan/atau kolom kosong dan mengembalikan rentang "dipangkas" yang hanya berisi data. Keunggulan TRIMRANGE adalah ia akan melacak data di lembar kerja seiring perubahannya. Ketika data ditambahkan atau dihapus, rentang akan disesuaikan secara otomatis, tanpa perlu menyesuaikan referensi sel secara manual. Ini berarti Anda dapat memasukkan hasil dari TRIMRANGE ke rumus lain, dan rumus tersebut akan selalu menggunakan data terbaru untuk menghitung hasilnya. Karena alasan ini, TRIMRANGE adalah pilihan yang baik untuk membuat rentang dinamis, atau rentang bernama dinamis, dengan rumus. Lihat di bawah untuk detailnya beserta contohnya. Sintaks untuk TRIMRANGE sederhana; cukup beri rentang, dan secara otomatis akan menghapus yang kosong

Contoh

Basic syntax

The syntax for TRIMRANGE is simple; just give it a range, and it will automatically remove empty rows and columns:

EXCEL
=TRIMRANGE(range) // remove empty rows and columns
Basic syntax

There are two optional arguments, trim_rows, and trim_columns, that let you fine-tune this behavior:

EXCEL
=TRIMRANGE(range,1,1) // remove leading rows and columns
=TRIMRANGE(range,2,2) // remove trailing rows and columns
=TRIMRANGE(range,1,2) // remove leading rows and trailing columns
Alternative syntax with the dot operator

You can also trim a range using an alternative syntax based on a "dot operator". When the Excel team added TRIMRANGE to Excel, they also extended the

EXCEL
=A:F // normal range, not trimmed
=A:.F // trim trailing rows and columns
=A.:F // trim leading rows and columns
=A.:.F // trim leading and trailing rows and columns
How TRIMRANGE works

TRIMRANGE removes empty rows and columns from the outer edges of a range. Starting from the outer boundary of the range, TRIMRANGE scans inward. When

EXCEL
=TRIMRANGE(A:J)
Example - Trimming a large range

The main function of TRIMRANGE, as the name suggests, is to "trim" a range, which means to remove empty rows and columns outside a block of data. You

EXCEL
=TRIMRANGE(G:J)
Example - Trimming a large range

In the worksheet, TRIMRANGE "trims" the range G:J by removing the empty rows above and below the data and returns the result as an array that lands in

EXCEL
=ROWS(TRIMRANGE(G:J)) // returns 12

See Also

DROP TOCOL TOROW