you could use an output filter then only echo if there something in it.
<?php
$html = '';
ob_start();
if(have_rows('field_name')):
while(have_rows('field_name')): the_row();
if(get_sub_field('sub_field') == 'functional assay'):
'<h4 class="underline">Functional Assay</h4>';
the_sub_field('sub_field');
endif;
endwhile;
endif;
$html = ob_get_clean();
if ($html) {
echo $html;
}
?>