Importing an Excel document into a project
First of all, better names than columnX would be nice. I guess the indentation is a copying-issue, otherwise this would be the next optimization. Furthermore I have the feeling that mixing the &amp;&amp; and the || in your condition without parenthesis is not what you want to do?

col0empty=checkIfColumnisEmpty(r.ItemArray[0])
col1empty=checkIfColumnisEmpty(r.ItemArray[1])
col2empty=checkIfColumnisEmpty(r.ItemArray[2])
col3empty=checkIfColumnisEmpty(r.ItemArray[3])
col4empty=checkIfColumnisEmpty(r.ItemArray[4])
col5empty=checkIfColumnisEmpty(r.ItemArray[5])

if ((!col0empty || !col1empty) &amp;&amp; col2empty &amp;&amp; col3empty &amp;&amp; col4empty &amp;&amp; col5empty)
{
    if (col0empty &amp;&amp; !col1empty) errorWithEmptyColumn("First");
    else if (!col0empty &amp;&amp; col1empty) errorWithEmptyColumn("Second");
    else if (!col0empty &amp;&amp; !col1empty)
    {
        //Code after validation
    }
}
else if ((col0empty &amp;&amp; col1empty) || !col2empty || !col3empty || !col4empty || !col5empty)
{
    if (col2empty) errorWithEmptyColumn("Third");
    else if (col3empty) errorWithEmptyColumn("Fourth");
    else if (col4empty) errorWithEmptyColumn("Fifth");
    else if (col5empty) errorWithEmptyColumn("Sixth");
    else
    {
        //Code after validation
    }
}
else
{
    throw new ImportBOQException("Error Uploading"); //don't throw raw exceptions
}
// } one to much

private void errorWithEmptyColumn(String columnName) throws ImportBOQException
{
    throw new ImportBOQException("Error importing document: "+columnName+" column is empty");
}


For further optimization it is import to know how similar the code in the two remaining branches is?

You could also extract the condition in an variable and give them a name: i.e. rowTypeX and rowTypeY. Maybe the result is more intuitive if you move the handling of the row types in a method each:

empty=col0empty &amp;&amp; col1empty &amp;&amp; col2empty &amp;&amp; col3empty &amp;&amp; col4empty &amp;&amp; col5empty
rowTypeX=col2empty &amp;&amp; col3empty &amp;&amp; col4empty &amp;&amp; col5empty;
rowTypeY=col0empty &amp;&amp; col1empty;
if ( empty) throw new ImportBOQException("Empty row");
else if (rowTypeX) handleRowTypeX(r);
else if (rowTypeY) handleRowTypeY(r);
else throw new ImportBOQException("Error Uploading");