Formula: Delete Rows If Common Data With Another Sheet

Feb 18, 2007

I have 2 spreadsheets of names (~2500 and ~1800) and a bunch of corresponding data continuing down the row. both are structured this same way:

Example:
Row1: LAST, FIRST, data1, data2, data3, etc...

is there a formula which can "check" the larger sheet for duplicate names (a row with exactly the same FIRST and LAST), and then either:
1) delete these rows from the smaller sheet
2) clear the contents of those rows
3) or at least flag them in some way so I can quickly delete them

it would be quite a task to eyeball and remove these rows one-by-one, so i'm wondering if a formula could somehow do it (I don't really know anything about visual basic)

One other piece of information which might be important:
For these rows containing duplicate first & last names between the 2 sheets, the entire row is not a duplicate entry; only the names will match (columns A & B)... The other columns down the row will have different values between sheet1 & sheet2. Not sure if this changes anything....

View 4 Replies


ADVERTISEMENT

Delete Rows Of Data If Cells Contain Same Value From Another Sheet

May 30, 2014

I have got a set of data in a workbook with Sheet 1 range A1 to K373 and a range of data in Sheet 2 ranging from A1 to A30. What I will like to do is to have a VBA code to loop through all the cells in Sheet 1 column C and check which are the cells which value matches those in Sheet 2. Those that matches in Sheet 1 will have the entire row deleted. I have come out with the following codes but it does not work.

[Code] ..........

View 3 Replies View Related

Delete Rows Of Data From Existing Sheet

Dec 26, 2011

I have an excel list of My Existing Customers and have recently purchased an excel list of all possible customers in my market that happens to have my existing customers listed in it as well. How can I remove my existing customers out of this purchased list so that I can import it into my Database as Prospects? I'm using Excel 2010. Deleting duplicates doesnt work for this. I want a function that looks at data in one spreadsheetA and if it finds it in the second spreadsheetB, it deletes the row out of SpreadsheetB.

View 9 Replies View Related

Export Data To Sheet And Then Delete Rows NOT Contain Today Date

Jan 25, 2013

I have found some excellent code that exports rows to individual sheets based on values in a column, and it works perfectly. I have found some code that deletes any rows that do not contain today's date:

VB:

Dim LR As Long, i As Long
Application.ScreenUpdating = False
LR = Range("O" & Rows.Count).End(xlUp).Row
For i = LR To 1 Step -1
If Range("N" & i).Value < Date Then Rows(i).Delete 'N is column "Treatment Date"
Next i
Application.ScreenUpdating = True

But I'm having trouble adding this to the code I'm already using (that is working):

VB:

Sub Copy_To_Worksheets_2()
'Note: This macro use the function LastRow and SheetExists
Dim My_Range As Range
Dim FieldNum As Long
Dim CalcMode As Long
Dim ViewMode As Long
Dim ws2 As Worksheet

[Code]...

I tried adding it after the code " ' delete columns (after exporting from Current Patients)" but I received the error "Compile error - Duplicate declaration in current scope" as it relates to Dim LR As Long.

I have attached my spreadsheet : Daily Treatment Summary.xlsm

View 1 Replies View Related

Sheet Of Data - Delete Rows That Do Not Meet Specific Criteria

Nov 29, 2011

I have a sheet of data. The data starts in row 4 and can be variable in length. I want to delete rows that do not meet a specific criteria, for example a location, Leeds, which is in column "i" of the table. I have written the below but it seems to delete data from row 1 rather than row 4 and repeat down each row

Code below

Sub deleterows()
Dim i As Integer
Dim intCounter As Integer
Dim strLocation() As String

p = Range(Cells(4, 6), Cells(4, 6).End(xlDown)).count

[Code] ..........

View 3 Replies View Related

Delete Formula In Multiple Sheet At One Time Without Loosing Data

Jul 18, 2014

I have multiple sheet in excel.All the excel sheet has a table with formula.Now i want to delete all formula in my all excel sheet at one time without delete/loosing my values.

View 4 Replies View Related

Delete Rows In Sheet A If Any Conditions Found In Sheet B

Jul 3, 2014

I am trying to write a macro where it will delete rows in Sheet A if any condition is found in the row which is based of conditions in Sheet B.

Sheet A :
Column A Column B Column C Column D
1234 ABC tyu 4588
asd qwe www 4455
zxc zdaa 1234 4441
ghj llll 1111 poo0

Sheet B (where i kept my conditions in Column A: )

Column A
1234
1111
(and many more....)

the end results will be the Row 1 and row 4 will be deleted. I have tried to google but most only contains deleting rows with a specific conditions.

View 10 Replies View Related

Delete Rows That Contains Zero And Copy Active Sheet To New Sheet

Oct 2, 2009

I want DELETE the rows that contains 0 (zero or -) in column F (SALDO BRUTO), when I click the Button (Clear). And How I can copy from this sheet to a new sheet in this workbook, but the names of new sheet automatic rename to next date or 2, and next when I click the Button "Copy to New Sheet".

View 2 Replies View Related

Delete Blank Rows (formula Not Deleting All Rows)

Sep 30, 2008

I have the following codes to delete all blank rows in column A

Dim lastrow As Long
lastrow = Sheet1.Range("A" & Rows.Count).End(xlUp).Row
MsgBox lastrow

With Sheet1
For t = 1 To lastrow
If Cells(t, 1) = "" Then
Rows(t).Delete
End If
Next t
End With

End Sub

Although it is working , it is not deleting all the blank rows at once, I have to keep pressing on the macro button running the macro several times, until all blank rows are completely deleted.

View 9 Replies View Related

Delete Empty Rows In New Sheet

Jan 10, 2013

My project looks like this:

I have a report that starts in column "A" and ends in column "J", I created several formulas in each cell, say, starting with column "K" till column "AA" to retrieve multiple data.

Not all formulas get values, there are many blanks. Longitude of the report is variable.

Now, I copy the content of K:AA and paste values only into new sheet. And that works fine.

Problem starts when I want to delete all empty rows in this new sheet.

Seems like after I paste, cells which I see as empty are in fact not empty, but non of them contains neither values nor formulas.

I tried 8 different ways of deleting emty rows and nothing works. They only delete empty rows above the content that I paste.

View 9 Replies View Related

Delete All The Rows Below From A Sheet If A Criteria Is Met

May 4, 2009

I have some data from A1 to A65536, there are few blank rows in between. i want to delete all the rows below the word "test" in that range. that is the word "Test" appears in A37686 that row and all the below Rows till the last row should be deleted.

View 9 Replies View Related

Find Value On Sheet & Delete Rows Below

Aug 6, 2008

I am trying to select all the data in every row below where the first "flat" entry in the worksheet is but it will only go to the bottom of the data in the column where it finds flat. Some data in other columns extends beyond this so it is not working for me. It would work for me to select everything from where it finds flat to the very last row 65536 but I can't figure out how to do that with what I have. I am then deleting all this data.

Cells.Find(What:="flat", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.EntireRow.Select
range(Selection, Selection.End(xlDown)).Select
range(Selection, Selection.End(xlDown)).Select
range(Selection, Selection.End(xlDown)).Select

View 3 Replies View Related

Moving Data From Rows To Columns And Delete Repeated Rows

Apr 16, 2014

removing duplicate rows and move other data frm rows to columns.xlsx.

I am attaching a sample excel sheet showing what I need to do.In the first tab, I have a list that includes duplicate rows (first column only). I want to remove those duplicate rows but I don't want to lose the data in the following columns which can be unique or duplicates as well.

see the desired result tab in the sheet to get an idea of what I am looking for as the end result.

Keep in mind that the actual source file I am working with could have up to 50000 row, and the expected results could be around 2000 rows. So nothing can be done manually.

View 5 Replies View Related

Delete Blank Columns And Rows In A Different Sheet?

May 27, 2014

I have command button in Sheet 3 (from where I will be running the macro) and I need a macro which will delete all the blank columns and rows in the data containing in Sheet 1.

View 2 Replies View Related

Delete Rows So That Student Only Appears Once On Sheet

Feb 13, 2014

I use this code to create sheets for courses but the student appears more than once - see attached Sample (Before sheet).

How can the code be changed so that the student only appears once on the sheet? - see attached Sample (After sheet).

Sample.xlsx‎

View 2 Replies View Related

Delete Rows Based On Criteria On Another Sheet?

Nov 21, 2012

few macros/vba that delete rows based on criteria in a cell.

I'm after something a little different. I have a workbook with sheets called Raw Data1, Raw Data2,Raw Data3, Raw Data4 and Raw Data5 and Menu.

There is a column of data in each of the sheets which has a column header of 'Location', however the column where this is located will vary from sheet to sheet. For example in Raw Data1, this is column 'J' and on Raw Data2 it will be column 'M', ( I'm not at work and can't remember the specific column positions for all sheets re: 'Location').

Is it possible to have on the 'Menu' sheet, say in cell B5 a value of 'Locationa' and have rows be deleted in each of the Raw Data that do not match the value in B5?

View 4 Replies View Related

Copy Sheet Then Delete Duplicate Rows

Jun 20, 2007

I have a worksheet that is composed a header row, and columns of data (client call results).
Each client is identified by a unique ID number in column A, a seperate column F has the 'call number, from 1 to x'.

So a client can have a single or multiple rows of data. Each client group of rows is sequenced with call 1 as line 1, call 2 at line 2, etc. etc. as your proceed down the rows.

The entire worksheet is already sorted (with a header row) ascending by client id and call #

What I want to accomplish is this

1 - copy the existing worksheet (CallRecords) to a new worksheet (CallToday)

2 - in the new worksheet, scan down (or up) from first data row (2) to the last row {ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row} and delete duplicate rows of the Client ID retaining the row with the max call number for that client id.

3 - sort the new worksheet (CallToday) ascending by column (G) date, and column (H) time.

View 6 Replies View Related

Auto Delete Rows To The Top Of The Sheet After Find

Sep 12, 2008

1) Highlight column A, and do a search on the word "Item"
2) Once it finds the word item, move 2 rows above it, and delete all rows above the word "Item"

The word Item at times can be on any row, and its very random, but its always in column, A. I tried doing it with a regular macro, but it seems to remember the row that I used, rather than two rows above the word "Item".

View 9 Replies View Related

Formatting Rows With Common ID Numbers?

Oct 23, 2013

I have almost 300-400 records of such data which needs formatting. There are n number of IDs in the first column & corresponding data in columns 2 & 3.

For those rows which have identical ID numbers, I need to fill those rows with some unique shade of color. If you look at the next sheet, I have manually colored the rows & that is my desired outcome. The shade of color does not matter. It just needs to be unique for each ID.

View 2 Replies View Related

Copy Different Sheets In Common Sheet

Jul 17, 2007

Recently a change my good old buddy Excel 2003 with 2007. I was happy when I understanad that the sheet has over 1 000 000 rows which is very suitable for me. However, I use a VBA code (which OZGRID done for me), but I can not use it with 2007. The reasons that the macro can't copy data over 65536 rows. I know that the problem is that macro but I don't know how to change it.
Here is the

Option Explicit
'GetFolderName vba code from
'http://www.erlandsendata.no/english/index.php?d=envbafoldersselectfolder

'CopyData macro written by
'Mudraker for tribestan at
'http://www.ozgrid.com/forum/showthread.php?t=65860

Private Type BROWSEINFO ' used by the function GetFolderName
hOwner As Long
pidlRoot As Long
pszDisplayName As String
lpszTitle As String
ulFlags As Long
lpfn As Long
lParam As Long
iImage As Long..........................

View 4 Replies View Related

Copy Data And Sheet Name To New Sheet And Delete The Old Sheet?

Mar 30, 2014

Example, I have a sheet named DATA1, I want to add a new worksheet, copy a certain range from the DATA1 sheet to the new sheet and rename it the same name DATA1 and delete the old DATA1 sheet.

Also, the sheetname will be unknown, the macro must get the sheet name first.

View 2 Replies View Related

Excluding Certain Rows From Delete Formula

Jun 1, 2009

I have a macro that deletes the active row. However if any cell within rows 1-8 are selected then I want the sub to end with an error message i.e. (Cannot delete these rows) The code I have tried is below but doesn't work:

View 2 Replies View Related

Delete Rows But Preserve Formula?

Apr 29, 2012

I have an inventory sheet with rows containing a formula. I've placed the same formula in all 65536 rows that Excel 2003 has.

I have a macro to delete unused items. It searches for an item number then deletes that row. (Actually it deletes the item number and a partial row based on an offset, but that was for an earlier version and an entire row would be okay) When a row is deleted, all the other rows move up and Excel creates a new last row (65536) The problem is that this new row has no formulas. While it's probably unlikely that I'll ever blow through 65536 rows, it seems sloppy to leave this unaccounted for.

Is there a way to either add the existing formula(s) to the last row...or insert a new row *somewhere* that is empty except for the formula of the other rows in the sheet? Here's what I have for the existing code.

Code:
'Search for item to delete based on entry to InputBox
Sub Delete_Item()
Dim FindString As String
Dim Rng As Range
Dim YesOrNoAnswerToMessageBox As String
Dim QuestionToMessageBox As String

[code].....

View 9 Replies View Related

Conditional Formula, Then Delete Rows

Jan 22, 2010

In column A, is a timeline - based on every 15 minutes.
In column H, I use conditional formula to change the cell color of any cell equal to or greater than the value of 00:00:07.
I would like to delete all other rows in column H that is under 7 seconds.
I would like the rest of the worksheet to stay in tact - so I can see the timeline. (or at least column A)
I have tried several macros and vba codes, and it either deletes all the rows or simply does not work with my worksheet.
I am unable to attach a worksheet, but I copy/pasted a simple view. This continues down the page, until 24 hours is complete.
Where 00:00:00 is, I am looking for anything over/equal to 00:00:07 - then delete the rest. The cells are formatted as 'general'.

View 9 Replies View Related

Hide Or Delete Rows Using A Formula

Jul 22, 2006

I am using the formula =IF(ISNUMBER(SEARCH("v",A2)),"OK", "Not OK") to say if cell a2 contains the letter v, then return ok. It would be really helpfull if I could say : if cell a2 contains the letter "v" or the letter "w" or the letter "x", then return ok.

View 2 Replies View Related

Delete Rows Which Contain A Formula Error #VALUE!

Sep 11, 2007

After performing several operations and sorting the results I end up with a lot if #VALUE! errors in colum B. I would like to search thru those results and delete any row containg "VALUE! in colum B

View 2 Replies View Related

Excel Macro Delete Rows Where Date Criteria Is In Another Sheet

Feb 28, 2014

I am trying to adapt a macro which deletes all rows in Worksheet 1 where the date in column K differs from a date in Worksheet 2. The date in Worksheet 2 will change each day.

I think the macro below could be used, but don't understand how to replace the "Value = ":70:" with a reference to the master date in Worksheet 2.

Sub test() Dim lr As Long, i As Long lr = Range("A1").End(xlDown).Row
For i = lr To 1 Step -1 If Cells(lr, 1).Value = ":70:" Then
Cells(lr, 1).EntireRow.Delete End If lr = lr - 1 Next i End Sub

View 2 Replies View Related

Comparing Two Columns In Two Different Sheets And Get The Common In The First Sheet

Jul 2, 2014

I've two sheets containing Incoming and Outgoing data. On the Outgoing Sheet, the Reply ref. shows the corresponding Incoming document replied for. I want to have the Reply Document ref. on the Incoming sheet corresponding to the document replied.

View 4 Replies View Related

Compare 2 Columns & Copy Common Cell Rows

Jan 21, 2010

this is in reference to a question I asked some time ago in which I was given the following: =IF( COUNTIF(SHEET1!$A$1:$A$1200,SHEET2!A1),SHEET2!A1,"")

To summize as this is not quite working, I have two worksheets and in Column A are id#s. Worksheet 1 has100's more rows of data than Worksheet 2. I need to find the unique ids from column A in Worksheet 1 that match Unique IDs in worksheet 2.

I need to copy the row of cells from worksheet 1 where the unique id equals that u.id in worksheet 2. That row needs to be copied to Sheet 2 that has the same unique id, and after the pre-existing cells which are already present.

So for instance: if Sheet1 A100 = Sheet2 A24, then copy row A100from Sheet 1 and paste it to Row A24 of SHeet 2 start with the first empty cell- just say Sheet2 G24 as an example.

Using the formula I was given before, it finds matches, but the pasted rows are off. If the match occurs with Sheet 1 A450 and Sheet 2 A36, it will copy the value from ROW/SHeet 1 A36 instead of ROW/Sheet 1 A450

View 9 Replies View Related

Macro To Delete Blank Rows With Formula

Jul 30, 2009

I'm trying to find a way to delete blank rows that contains formula. I have two excel sheets.
sheet1 contains information and sheet2 references the values from sheet1. Let's say I put the following values in sheet1:

ColA
AAA
(blank)
(blank)
BBB
(blank)
CCC

After entering above values in sheet1, here's what sheet2 would look like:

ColA
AAA
(blank that holds formula) =IF(ISBLANK(Sheet1!A2)," ",Sheet1!A2)
(blank that holds formula) =IF(ISBLANK(Sheet1!A3)," ",Sheet1!A3)
BBB
(blank that holds formula) =IF(ISBLANK(Sheet1!A5)," ",Sheet1!A5)
CCC

What I really wanted to happen is for macro to eliminate blank rows in sheet2 to look something like:
ColA
AAA
BBB
CCC

Is it something possible?

View 14 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved