Generate Code with Replacement Pattern
Available since AlchemyJ v5.0
Description
The Replacement pattern will replace the reference cells use its actually calculation cells, then output the result to the current active cell. For replacement pattern it is only support used in excel table and only support to select two cells at same time.
In the selected range it only has one cell is active cell (usually the first one cell), the active cell within a range is not highlighted. The rest of the selected cells are highlighted with a different color. such as below, in the range A1 to C5, A1 is the active cell.
Example
For this example, it will to calculate the final salary for every staff.
Name | Salary | Increment | New Salary | Extra | Final |
---|---|---|---|---|---|
David | 10000 | 1.1 | [Salary]*[Increment] | 1.2 | [New Salary]*[Extra] |
John | 20000 | 1.2 | [Salary]*[Increment] | 1.3 | [New Salary]*[Extra] |
Then select the cell which need to use Replacement pattern, the active cell is Final Salary, so need select the cell I39 and H39 , then click Tools->More Tools->Generate Code with Replacement Pattern
Then it will replace the formula use the actually reference cells and output the result to the active cell (I39)
Then can delete the reference column [Final], in Column [Final Salary] the [New Salary] is replaced by [Salary]*[Increment]
Note:
- When select cells from left to right the top left cell is active cell
- When select cells from right to left the top right cell is active cell.
- When select cells one by one with press the Ctrl key, the last one cell is active cell.
- Press Enter (move down by default) or Tab (move right by default) to select the active cell.
- For Replacement Pattern it only support select 2 cells at same time.
- If it has no any calculation logic can be replaced it will show the warning message "No match formula found."