remove items from a excel column

MilesLogan
MilesLogan used Ask the Experts™
on
HI EE

I have 1000 lines in column A and have 100 lines in column B
I need to remove the 100 items in column B , from column A

Any ideas ?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2014

Commented:
Will there be multiple columnB values in columnA?

You should be able to use columnB as a criteria range as long as they have the same column header.  Apply an advanced filter (In-place) and then delete the visible columnA cells (with shift-up)

Author

Commented:
No --- >Will there be multiple columnB values in columnA?

Can you give me a more detail walk through or a link on this ?

You should be able to use columnB as a criteria range as long as they have the same column header.  Apply an advanced filter (In-place) and then delete the visible columnA cells (with shift-up)
Top Expert 2014

Commented:
Advanced filter should be close to the regular filter menu/ribbon item.  There needs to be the same column header value at the top of colA and colB.  The dialog is simple enough.
Introduction to R

R is considered the predominant language for data scientist and statisticians. Learn how to use R for your own data science projects.

Excel & VBA Expert
Most Valuable Expert 2018
Awarded 2015
Commented:
If you are interested for a formula solution, you may try this.....

Assuming you have row1 as header row, column A has data in the range A2:A1000 and column B has data in the range B2:B100 then in another column say in C2 try this Array Formula which requires confirmation with Ctrl+Shift+Enter instead of Enter alone.

In C2
=IFERROR(INDEX($A$2:$A$1000,SMALL(IF($A$2:$A$1000<>"",IF(ISNA(MATCH($A$2:$A$1000,$B$2:$B$100,0)),ROW($A$2:$A$1000)-ROW($A$2)+1)),ROWS(A$1:A1))),"")

and copy down until you get blank cells.
The above formula will return values from column A which are not present in column B.

******************************
Remember that an Array Formula is confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER.  You will know the array is active when you see curly braces { } appear around your formula.  If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.  Press F2 on that cell and try again.
Rob HensonFinance Analyst
Commented:
Simpler formula than that suggested above.

In column C:

=MATCH(A1,$B$1:$B$1000,0)

This will give a number result for those in column A that are also in column B and an #NA result for those that are not found. Apply a filter and in the drop down on column C deselect the #NA option. This will leave only the values that are in column B visible. Then two options,

1) select the column A values as a block and press delete key, this will just delete the visible values. When you disable the filter the blank rows will be interspersed so data will need to be sorted to get the values together.

2) select the column A values as a block and delete rows. This will leave the results all together as a block with no blank rows but it will also delete the values in column B because the whole row has been deleted. If you want this option but don't want the column B values deleted then move the column B values to a range below the initial 1000 rows in column A or to another sheet.

Thanks
Rob H

Author

Commented:
Thank you both !

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial