Reduce Rows
Reduce worksheet by merging or deleting rows
Minimum Origin Version Required: 9.1 SR0
1. wreducerows method:=merge nrows:=3 merge:=ave start:=2;
2. wreducerows method:=hidden;
Please refer to the page for additional option switches when accessing the x-function from script
Display Name |
Variable Name |
I/O and Type |
Default Value |
Description |
---|---|---|---|---|
Input | irng |
Input Range |
|
Specifies the input data range. |
Reduce Method | method |
Input int |
|
Specifies the reduce method.
Option list:
|
Delete Entire Row | entire |
Input int |
|
Specifies to reduce rows by deleting whole row based on missing or masked value in reference column.
This option is only available when Reduce Method is Delete rows with missing values (method=missing) or Delete rows with masked values (method=merge). And the variable irng is Reference Column Option list:
|
Merge/Delete Rows | nrows |
Input int |
|
Specifies how many rows to merge or delete. This option is only available when selecting Delete N rows, then skip M rows or Reduce N rows with merged values as Reduce Method. |
Skip Rows | skip |
Input int |
|
Specifies how many rows to skip. This option is only available when selecting Delete N rows, then skip M rows as Reduce Method. |
Merge by | merge |
Input int |
|
Specifies the value to replace the merged data points. This option is only available when selecting Reduce N rows with merged values as Reduce Method.
Option list:
|
Starting Row to Merge/Delete | start |
Input int |
|
Specifies the starting row to merge/delete. |
End Row to Merge/Delete | end |
Input int |
|
Specifies the end row to merge/delete. Script accessible only. |
Output | orng |
Output Range |
|
Specifies the output range. |
This X-Function is used to delete rows or merge rows with specified statistics data. See also here.
Example 1
Example 2
Suppose we have a worksheet data. We want to keep rows where col(B)'s value is bigger than 5000 and delete the rest. Run codes below:
//add a filter to col(B) and hide all rows <5000 wks.col2.filter = 1; wks.col2.filter$="x>5000"; wks.runfilter(); wks.col2.filter=0; //delete hidden rows wreducerows method:=hidden;
Keywords:data reduction