Can I remove blanks from a range without using sort?

G

Guest

I have a range of cells A1:a10, say, which obtain data from another source.
Some of those cells a3, a6:a8, say, under certain conditions, will be blank.
How do I reorder this range such that the cells containing information are
listed together, removing the blanks? I want to do this using a formula,
rather than filter or sort, as the data, and hence the blank cells, will
change, and I want to perform analysis on the cells containing data.
 
R

R.VENKATARAMAN

this is

from one of the newsgroup correspondents

use this code statement

Range("a1:a10").SpecialCells(xlCellTypeBlanks).EntireRow.Delete



=================================
 
G

Gord Dibben

Hugh

What type of analysing are you doing on the data?

Most Functions will ignore blanks in a range.

=SUM(A1:A10) ignores the blanks.

To delete the blanks if desired..........

Select A1:A10 then F5>Special>Blanks>OK

Edit>Delete>Shift Up.


Gord Dibben Excel MVP
 
H

Hugh

{=INDEX(A$1:A$10,SMALL(IF(A$1:A$10<>0,ROW(A$1:A$10),""),ROW(A1:A1)))}
(control-shift-enter) will work if they are really blanks. If the
"blank" values are "" returned from elsewhere, they will remain "". If
0 is returned, they will be removed.
Note that your 1st reference must be to A1. Won't work if you use A2,
for example.

HTH
 
G

Guest

This is EXACTLY what I wanted. Thanks a million for saving me a huge amount
of time.
 

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