src/org/tiefaces/components/websheet/utility/ShiftFormulaUtility.java
protected static Ptg[] fixupRefRelativeRowOneToMany(final Object ptg,
			final byte originalOperandClass, final List<SerialRow> rowList,
			final Ptg[] ptgs, final int position) {
		int size = rowList.size();
		Ptg[] newPtg = null;
		// if followedby valueoperator, then change to multiple ptg plus Add
		// e.g. (A1) --> (A1+A2)
		if (isFollowedByValueOperator(ptgs, position)) {
			if (ptg instanceof RefPtgBase) {
				newPtg = new Ptg[size + 1];
				buildDynamicRowForRefPtgBase(ptg, originalOperandClass,
						rowList, newPtg, false);
				newPtg[rowList.size()] = AddPtg.instance;
			}
		} else {
			// otherwise change to mutiple ptg plus parenth
			// e.g. SUM((A1)) --> SUM((A1),(A2))
			// SUM((A1:B1)) --> SUM((A1:B1),(A2:B2))
			newPtg = new Ptg[(size * 2) - 1];
			if (ptg instanceof RefPtgBase) {
				buildDynamicRowForRefPtgBase(ptg, originalOperandClass,
						rowList, newPtg, true);
			} else {
				buildDynamicRowForAreaPtgBase(ptg, originalOperandClass,
						rowList, newPtg);
			}
		}
		return newPtg;
	}
protected static Ptg[] fixupRefRelativeRowOneToMany(final Object ptg,
			final byte originalOperandClass, final List<SerialRow> rowList,
			final Ptg[] ptgs, final int position) {
		int size = rowList.size();
		Ptg[] newPtg = null;
		// if followedby valueoperator, then change to multiple ptg plus Add
		// e.g. (A1) --> (A1+A2)
		if (isFollowedByValueOperator(ptgs, position)) {
			if (ptg instanceof RefPtgBase) {
				newPtg = new Ptg[size + 1];
				buildDynamicRowForRefPtgBase(ptg, originalOperandClass,
						rowList, newPtg, false);
				newPtg[rowList.size()] = AddPtg.instance;
			}
		} else {
			// otherwise change to mutiple ptg plus parenth
			// e.g. SUM((A1)) --> SUM((A1),(A2))
			// SUM((A1:B1)) --> SUM((A1:B1),(A2:B2))
			newPtg = new Ptg[(size * 2) - 1];
			if (ptg instanceof RefPtgBase) {
				buildDynamicRowForRefPtgBase(ptg, originalOperandClass,
						rowList, newPtg, true);
			} else {
				buildDynamicRowForAreaPtgBase(ptg, originalOperandClass,
						rowList, newPtg);
			}
		}
		return newPtg;
	}
protected static Ptg [ ] fixupRefRelativeRowOneToMany ( final Object ptg , final byte originalOperandClass , final List < SerialRow > rowList , final Ptg [ ] ptgs , final int position ) { int size = rowList . size ( ) ; Ptg [ ] newPtg = null ; // if followedby valueoperator, then change to multiple ptg plus Add
 // e.g. (A1) --> (A1+A2)
 if ( isFollowedByValueOperator ( ptgs , position ) ) { if ( ptg instanceof RefPtgBase ) { newPtg = new Ptg [ size + 1 ] ; buildDynamicRowForRefPtgBase ( ptg , originalOperandClass , rowList , newPtg , false ) ; newPtg [ rowList . size ( ) ] = AddPtg . instance ; } } else { // otherwise change to mutiple ptg plus parenth
 // e.g. SUM((A1)) --> SUM((A1),(A2))
 // SUM((A1:B1)) --> SUM((A1:B1),(A2:B2))
 newPtg = new Ptg [ ( size * 2 ) - 1 ] ; if ( ptg instanceof RefPtgBase ) { buildDynamicRowForRefPtgBase ( ptg , originalOperandClass , rowList , newPtg , true ) ; } else { buildDynamicRowForAreaPtgBase ( ptg , originalOperandClass , rowList , newPtg ) ; } } return newPtg ; }
Change formula ptg by replace one ref with multiple ref. We require user
follow the rule to define dynamic formula. e.g. If cell reference in
formula maybe become multiple cells, then should use round brackets
around it.

Case 1: = (A1) + A2 + A3 Case 2: = SUM((A1)) Case 3: = SUM((A1:A2))

@param ptg
the ptg
@param originalOperandClass
the original operand class
@param rowList
the row list
@param ptgs
the ptgs
@param position
the position
@return the ptg[]
Change formula ptg by replace one ref with multiple ref . We require user follow the rule to define dynamic formula . e . g . If cell reference in formula maybe become multiple cells then should use round brackets around it .