Generate Code with Concat Pattern
Available since AlchemyJ v5.0
Description
The Contact pattern will concat multiple selected cells with "&" into a single cell and output the result to the current active cell to reduce the complexity.
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
There are a few examples of the Concat pattern.
Example 1
For this example to generate a dynamic Order Id by combine columns Date, Customer No., Amount, Risk, Customer Group.
Date | Customer No. | Amount | Risk | Customer Group | Order Id |
---|---|---|---|---|---|
today() | CUS-2-25 | 5000 | H: Amount>=10000 M: Amount<10000 and Amount>=5000 L: Amount<5000 | LEFT([@[Customer No.]],3) |
The select the cells which need to concat with Concat pattern, the active cell is Order Id, so need select the cells from H27 to C27, then click Tools->More Tools->Generate Code with Concat Pattern
Then it will concat multiple cells in the selected range into a single and output the result to the active cell (H27)
Then can delete the cell C27, F27 and G27 because their already combine into the active cell H27. only left the reference cell C27, D27 and active cell E27.
Customer No. | Amount | Order Id |
---|---|---|
CUS-2024 | CUS-2024 | =TEXT(TODAY(),"yyyymmdd") & C27 & D27 & IF([@Amount]>=10000,"H",IF(AND([@Amount]>=5000,[@Amount]<10000),"M","L")) & LEFT([@[Customer No.]],3) |
Example 2
The selected cells not in a range, can select the cell one by one from left to the right (Ctrl+cell) and the last selected cell is the active cell.
Then it will concat multiple cells formula or value into the active cell (J27)
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.