Vendor/phpspreadsheet/phpoffice/phpspreadsheet/src/PhpSpreadsheet/ReferenceHelper.php
private function updateSingleCellReference($pCellReference = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0)
    {
        if (Coordinate::coordinateIsRange($pCellReference)) {
            throw new Exception('Only single cell references may be passed to this method.');
        }

        // Get coordinate of $pBefore
        list($beforeColumn, $beforeRow) = Coordinate::coordinateFromString($pBefore);

        // Get coordinate of $pCellReference
        list($newColumn, $newRow) = Coordinate::coordinateFromString($pCellReference);

        // Verify which parts should be updated
        $updateColumn = (($newColumn[0] != '$') && ($beforeColumn[0] != '$') && (Coordinate::columnIndexFromString($newColumn) >= Coordinate::columnIndexFromString($beforeColumn)));
        $updateRow = (($newRow[0] != '$') && ($beforeRow[0] != '$') && $newRow >= $beforeRow);

        // Create new column reference
        if ($updateColumn) {
            $newColumn = Coordinate::stringFromColumnIndex(Coordinate::columnIndexFromString($newColumn) + $pNumCols);
        }

        // Create new row reference
        if ($updateRow) {
            $newRow = $newRow + $pNumRows;
        }

        // Return new reference
        return $newColumn . $newRow;
    }
private function updateSingleCellReference($pCellReference = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0)
    {
        if (Coordinate::coordinateIsRange($pCellReference)) {
            throw new Exception('Only single cell references may be passed to this method.');
        }

        // Get coordinate of $pBefore
        list($beforeColumn, $beforeRow) = Coordinate::coordinateFromString($pBefore);

        // Get coordinate of $pCellReference
        list($newColumn, $newRow) = Coordinate::coordinateFromString($pCellReference);

        // Verify which parts should be updated
        $updateColumn = (($newColumn[0] != '$') && ($beforeColumn[0] != '$') && (Coordinate::columnIndexFromString($newColumn) >= Coordinate::columnIndexFromString($beforeColumn)));
        $updateRow = (($newRow[0] != '$') && ($beforeRow[0] != '$') && $newRow >= $beforeRow);

        // Create new column reference
        if ($updateColumn) {
            $newColumn = Coordinate::stringFromColumnIndex(Coordinate::columnIndexFromString($newColumn) + $pNumCols);
        }

        // Create new row reference
        if ($updateRow) {
            $newRow = $newRow + $pNumRows;
        }

        // Return new reference
        return $newColumn . $newRow;
    }
Update single cell reference.

@param string $pCellReference Single cell reference
@param string $pBefore Insert before this one
@param int $pNumCols Number of columns to increment
@param int $pNumRows Number of rows to increment

@throws Exception

@return string Updated cell reference