if (NON_EMPTY_SELECTION)
{
	data_rows  	 		= Columns 	(SELECTED_CHART_ROWS);
	selected_columns	= {data_rows, 1};
	different_columns	= 0;
	first_row			= SELECTED_CHART_ROWS[0];
	counter				= 0;

	while ((counter<data_rows)&&(SELECTED_CHART_ROWS[counter]==first_row))
	{
		selected_columns [different_columns] = SELECTED_CHART_COLS[counter];
		different_columns = different_columns+1;
		counter = counter + 1;
	}

	column_stensil = {different_columns,1};

	for (counter=0; counter < different_columns; counter = counter + 1)
	{
		column_stensil [counter] = selected_columns[counter];
	}

	selected_columns = 0;

	/*check selection consistency*/

	counter = different_columns; 

	while (counter+different_columns < data_rows)
	{
		first_row			= SELECTED_CHART_ROWS[counter];
		for (counter2 = 0; counter2 < different_columns; counter2 = counter2 + 1)
		{		
			if ((SELECTED_CHART_COLS[counter2+counter]==column_stensil[counter2])&&(SELECTED_CHART_ROWS[counter2+counter]==first_row))
			{
				continue;
			}
			break;
		}
		if (counter2 != different_columns)
		{
			counter = -1;
			break;
		}
		counter = counter+different_columns;
	}

	if (counter+different_columns!=data_rows)
	{
		fprintf (stdout, "Invalid selection: the same rows must be selected in each column\n");
	}
	else
	{
		fprintf (stdout, "Enter the column operation in terms of data_column[index], where index is between 0 and ", different_columns-1, ":");
		fscanf  (stdin, "String", column_op);
		
		data_column = {different_columns,1};
		
		for (counter=0; counter < data_rows; counter = counter+different_columns)
		{
			for (counter2 = 0; counter2 < different_columns; counter2 = counter2 + 1)
			{
				data_column[counter2] = SELECTED_CHART_DATA[counter+counter2];
			}
			
			data_column2 = data_column;
			ExecuteCommands (column_op);

			for (counter2 = 0; counter2 < different_columns; counter2 = counter2 + 1)
			{
				if (data_column[counter2] != data_column2[counter2])
				{
					SELECTED_CHART_DATA[counter+counter2] = data_column[counter2];
					break;
				}
			}
		}
		data_column  = 0;
		data_column2 = 0;
		UPDATE_CELL_DATA = 1;
	}

	column_stensil = 0;
}
else
{
	NON_EMPTY_SELECTION = -1;
}
