Sort Descending with IF and empty cells

M

Mike

I am trying to sort a column descending. The cells functions are
=IF(J38=0,"",I38/J38). I want nothing to appear in the cell if
the result is true, but this poses a problem when I run my macro for sorting
descending. It puts my blank cells at the top. Is there a way to sort
descending but have my blank cells all at the bottom? Any assistance would
be appreciated.
 
P

Pete_UK

Instead of returning "", you could return a large negative value, like
-9999. You can apply conditional formatting such that if the cell
contains -9999 the foreground colour is set to white, so that it
appears blank. When you sort in descending order these records will
drop to the bottom.

If you are using a macro, though, you could physically empty the cells
so that they do not contain "", so then a sort would put them at the
bottom anyway.

Hope this helps.

Pete
 
M

Mike

Perfect. Thank you.
--
Mike


Pete_UK said:
Instead of returning "", you could return a large negative value, like
-9999. You can apply conditional formatting such that if the cell
contains -9999 the foreground colour is set to white, so that it
appears blank. When you sort in descending order these records will
drop to the bottom.

If you are using a macro, though, you could physically empty the cells
so that they do not contain "", so then a sort would put them at the
bottom anyway.

Hope this helps.

Pete
 
P

Pete_UK

Glad to hear it, Mike - thanks for feeding back (have been away for a
few days).

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top