2020-02-04

Coalesce cells in Excel

Problem

We'd like to coalesce cells in a row in Excel. In our example we'd like the first non-blank occurrence found for each row.

Solution

  1. INDEX and MATCH in conjunction with ISBLANK
  2. {=INDEX(A2:F2,MATCH(FALSE,ISBLANK(A2:F2),FALSE))}
    
    We need to press CTRL + SHIFT + ENTER to enter this array formula. This formula works fine as long as there are not zero-length string characters ("") in the cells. E.g.: row 5 in our example. Otherwise it will return that zero-length string instead of the first number.

  3. INDEX and MATCH in conjunction with EXACT
  4. {=INDEX(A2:F2,MATCH(FALSE,EXACT("",A2:F2),FALSE))}
    
    We need to press CTRL + SHIFT + ENTER to enter this array formula. This will solve the issue of cells containing zero-length string characters.

Results

No hay comentarios:

Publicar un comentario

Nube de datos