Merge rule

The merge rule lets you merge cells, rows and columns based on location or their content.

If you've ever worked in Microsoft Excel or any other spreadsheet, you'll be familiar with merging. If you select a range in Excel and click Merge, Excel will merge your selection into one big cell. The merged cells will then display whatever the text was in the top-left cell and delete everything else in your selection.

Grunt works similarly, but there are some important differences. First, Grunt doesn't delete the underlying data when you merge, it just hides it. In other words, Grunt will merge the structure of your Visual Grid, but keep the data intact. Second, Grunt has several different merge modes, meaning it can be a bit smarter about how it merges cells.

Default merge preserves the top left value

When you merge to cells together, Grunt's default mode is to set the content of the top-left cell as the content of the merged cell, just like in Excel. In the example below the first row is merged, and you can see how the A from the top left corner is kept visible. 


Similar Values

If you instead want to merge neighboring/adjacent cells that contain the same value, you select Similar values mode. This is great if you have pivot data or data where you've repeated text several times and want to merge it into one. 


Empty cells

The Empty cells-function is somewhat similar to Excel's Center across selection. It basically means that if you switch to that mode, the left, top-most cell will merge with any adjacent empty cells. This is useful if you just write some text in a cell somewhere and want to merge with surrounding cells.



Merge behavior can be quite complex, and you may have noticed Grunt has an extra merge property called Direction. Sometimes, merging Similar values or Empty cells means Grunt has a choice of merging in several directions. The Direction property lets Grunt know which direction it should prioritize.  The default Direction setting is Rows, then columns.  If you switch the Direction mode to Columns, then rows the cells will merge downwards to cells in the same column instead. 


Rows, then columns:                         Columns, then rows: