Search code examples
excelexcel-formulaexcel-2010excel-2007

Remove blank cells calculated from formula using excel


Have written a simple formula to pick the sl.no based on the 1st character; But I need to format the output in this below format by removing the blank cells.

Formula

=IF(LEFT(B3,1)="A",A3,"")

Expected Format enter image description here

Output enter image description here


Solution

  • Try AGGREGATE() function. Excel-2007 do not have Aggregate function.

    =IFERROR(INDEX($A$3:$A$16,AGGREGATE(15,6,(ROW($A$3:$A$16)-ROW($A$2))/(LEFT($B$3:$B$16,1)=C$2),ROW(1:1))),"")
    

    If you do not have Aggregate() function then use below array formula.

    =IFERROR(INDEX($A$3:$A$16,SMALL(IF(LEFT($B$3:$B$16,1)=C$2,ROW($B$3:$B$16)-ROW($B$2),""),ROW(1:1))),"")
    

    Array formula needs to enter by pressing CTRL+SHIFT+ENTER.

    enter image description here