Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have rows of data, some cells are empty and some contain a number. I need to identify how many contiguous empty cells exist at the end of each row.

I've tried using a string of nested IF statements, but there are often 15-20 empty cells and I don't think that I can have 20 nested IF statements (?).

for example: _ _ 1 2 _ _ 2 _ _ 1 1 1 _ _ _ _ (underscore represents a blank cell) For this row, there a 4 empty cells at the end of the row. I need to count empty cells (backwards from the end of the row) and then stop when a non-empty cell is reached.

Can anyone help?

share|improve this question
    
COUNTBLANK or SUMPRODUCT(TRIM(CLEAN(bla1:Bla2))="") at the end of the rows? – Blomkvist May 5 '11 at 19:49
    
Hi Blomkvist, thanks for your reply. I tried your suggestion but unfortunately this counts every individual empty cell in the entire row... I am trying to find out how many contiguous blank cells exist at the end of a row... for example: _ _ 1 2 _ _ 2 _ _ 1 1 1 _ _ _ _ (underscore represents a blank cell) For this row, there a 4 empty cells at the end of the row. I need to count empty cells (backwards from the end of the row) and then stop when a non-empty cell is reached. – Andy May 6 '11 at 15:14

It's been a while so I'm hoping a LibreOffice solution may be better than nothing:

SU279758 example

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .