Excel Pros, I need you help.

KK

Lifer
Jan 2, 2001
15,903
4
81
I have a spread sheet that consists of columns A-P, and rows 2-26,000 something. I basically want to match column E & F to M & N respectively, if they match on the same row then I would like it to delete that row. To put it in other terms, if E & F don't match M & N respectively then output that row to another sheet. Can this be done in Excel? And if so, how?

Anyone?

TIA,
KK
 

Dudd

Platinum Member
Aug 3, 2001
2,865
0
0
This is very possible with Excel. I poked around in Excels Macro features one afternoon during my summer job, and I can kindof remember what you'd have to do. Now, I don't know how to output to another cell, but I'm going to assume that you don't need the rows that will be deleted. First, declare a variable and set it to 1. Then, set up a while loop such that (x<=SPREADSHEET.ACTIVEROWS). (I know that's not exact, but it should be close to what you want). Then, set up a simple boolean statement such that if (E[x]!=M[x] && F[x]!=N[x]) (exact notation is probably wildly off, as I said I only have one afternoon's experience with Excel), and if that is true, then ROW[x].DELETE. Run a search on google for the exact functions you need to implement my logic. Hope that helps somewhat, as ATOT'ers helped me out a lot when I was in your situation.
 

KK

Lifer
Jan 2, 2001
15,903
4
81
Originally posted by: Dudd
This is very possible with Excel. I poked around in Excels Macro features one afternoon during my summer job, and I can kindof remember what you'd have to do. Now, I don't know how to output to another cell, but I'm going to assume that you don't need the rows that will be deleted. First, declare a variable and set it to 1. Then, set up a while loop such that (x<=SPREADSHEET.ACTIVEROWS). (I know that's not exact, but it should be close to what you want). Then, set up a simple boolean statement such that if (E[x]!=M[x] && F[x]!=N[x]) (exact notation is probably wildly off, as I said I only have one afternoon's experience with Excel), and if that is true, then ROW[x].DELETE. Run a search on google for the exact functions you need to implement my logic. Hope that helps somewhat, as ATOT'ers helped me out a lot when I was in your situation.

I'll look into that, it sounds pretty simple.

Thanks



KK
 

KLin

Lifer
Feb 29, 2000
30,479
780
126
Originally posted by: KK
Originally posted by: Dudd
This is very possible with Excel. I poked around in Excels Macro features one afternoon during my summer job, and I can kindof remember what you'd have to do. Now, I don't know how to output to another cell, but I'm going to assume that you don't need the rows that will be deleted. First, declare a variable and set it to 1. Then, set up a while loop such that (x<=SPREADSHEET.ACTIVEROWS). (I know that's not exact, but it should be close to what you want). Then, set up a simple boolean statement such that if (E[x]!=M[x] && F[x]!=N[x]) (exact notation is probably wildly off, as I said I only have one afternoon's experience with Excel), and if that is true, then ROW[x].DELETE. Run a search on google for the exact functions you need to implement my logic. Hope that helps somewhat, as ATOT'ers helped me out a lot when I was in your situation.

I'll look into that, it sounds pretty simple.

Thanks



KK


so basically you want something that will make sure the cells in column E are = to M, then F = N correct?
 

KK

Lifer
Jan 2, 2001
15,903
4
81
Originally posted by: KLin
Originally posted by: KK
Originally posted by: Dudd
This is very possible with Excel. I poked around in Excels Macro features one afternoon during my summer job, and I can kindof remember what you'd have to do. Now, I don't know how to output to another cell, but I'm going to assume that you don't need the rows that will be deleted. First, declare a variable and set it to 1. Then, set up a while loop such that (x<=SPREADSHEET.ACTIVEROWS). (I know that's not exact, but it should be close to what you want). Then, set up a simple boolean statement such that if (E[x]!=M[x] && F[x]!=N[x]) (exact notation is probably wildly off, as I said I only have one afternoon's experience with Excel), and if that is true, then ROW[x].DELETE. Run a search on google for the exact functions you need to implement my logic. Hope that helps somewhat, as ATOT'ers helped me out a lot when I was in your situation.

I'll look into that, it sounds pretty simple.

Thanks



KK


so basically you want something that will make sure the cells in column E are = to M, then F = N correct?

Yes. if E is = to M and F is = to N then I want that particular row deleted.
This is what I got so far
Sub Delete()
For x = 2 To 27000
If E(x) = M(x) & F(x) = N(x) Then Rng.Rows(x).EntireRow.Delete
x = x + 1
Next



End Sub

That's my pitiful attempt. Of course it doesn't work.
Any ideas.

KK