Loop in Excel

The Loop in Excel action loops through different elements of a spreadsheet. An element in this context could be a sheet, a column, a row or a cell and is identified by the step's Range Finder. In each iteration, the appropriate element is marked as a named range.

Properties

The Loop in Excel action can be configured using the following properties:

Loop Over

This determines what kind of element the action will loop over. There are 4 possibilities for this:

Sheets

The action will loop over sheets in the spreadsheet document. No range finder is needed for this choice.

Columns

The action will loop over the columns in the range found by the range finder.

Rows

The action will loop over the rows in the range found by the range finder.

Cells

The action will loop over the cells in the range found by the range finder.

First Index

The number of the first element to include in the loop. The number can be specified to count either forward from the first element, or backward from the last element.

Last Index

The number of the last element to include in the loop. The number can be specified to count either forward from the first element, or backward from the last element.

Increment

Makes the loop skip elements. For example, if an increment of 2 is specified, the loop will skip every second element.

Loop Backwards

Selects that the loop should loop through the matching elements in reverse order. Please note that the loop will go through exactly the same elements as if it were looping forward just in reversed order. This means that the First Index is referring to first element in the selection of elements to loop over and not the first element visited when looping (actually it will be the last when looping backwards).

Range Name

Has two options, Auto or Named.Auto gives the range a name which is number. The first Auto-numbered range will have number 1, the next number 2 etc. Note that the number may change if additional Auto-numbered ranges are inserted before this step (on the same page).Named gives the range a fixed and explicitly stated name, which has several advantages:

  • It is easier to remember what the named range identifies if it has a well-chosen name
  • An explicitly named range is not affected if another named range is inserted before it
  • If you use the same name again in Set Named Range, the name will simply be made to refer to the new range (useful for stateful in-page looping)