You have mentioned to skip the selected row in a gridview you can try something like below
int rowskip = 1;
for (int i = rowskip; i <= dataGridView1.Rows.Count - 1; i++)
{
if( dataGridView1.Rows[i].Selected)
{
continue;
}
Double firsttotal = Convert.ToDouble(dataGridView1.Rows[i - 1].Cells[4].Value);
Double amount = Convert.ToDouble(dataGridView1.Rows[i].Cells[2].Value);
Double sum = firsttotal + amount;
dataGridView1.Rows[i].Cells[4].Value = sum.ToString();
}