How to remove special duplicate?

MacFil

New Member
Joined
Dec 27, 2004
Messages
6
Hi all. I'm new to Excel. I mostly work with Access. I made a search but could not find what I was looking for. I have a report in Access that I transfer to Excel. What I would like to acheive is to revove duplicate line but only some special duplicate.
Railcars 11-04-2005-3 .xls
ABCDEFGHIJ
1Railcar#CodeHeat#Std#GradeQtySchSizeLocation/Remarks
2102QI602NW85463-2QI22681/84V000040238.50
3102QI602NW85463-2QI22681/84V000040318.50
4102QI602NW85464QI22681/84V0000228.50
5
6104QI600NW86137QI21676/790000038139.00
7104QI600NW86137QI21676/790000038259.00
8
9135471QI602NW86948QI1311038CH35138.50
10135471QI602NW86948QI1311038CH35228.50
11135471QI602NW86947QI1311038CH8329.00
12135471QI602NW86947QI1311038CH8269.00
Railcars to unload Query


In this example, you have the Heat # coming up a couple time. I must say where the column Sch is where the heat is shecule under different PO.
So you have the same Heat # coming back in the same railcar.
I would like to keep only one heat out of 2 or 3 or 4..

How can it be done?

Thanks for your help.
JP
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
You culd run a macro on this. I have assumed that you are basing the deletions on the reference in column A

sub macro()
dim cell as range
range("A2:A"&[a65536].end(xlup).row)select
for each cell in selection
if cell = cell.offset(-1,0) then cell.offset(0,3).clearcontents
next cell
end sub
 
Upvote 0
tactps, thanks for your reply

I just tried the macro and at the line Range("A2:A"&[a65536].end(xlup).row)select
It gave a compile error at Range. Invalide use of Property.

What does it mean?

Thanks
JP
 
Upvote 0
JP

Why can't you use a query in Access to do this?
 
Upvote 0
Got the Macro running

I gor the marco running. It was a syntax error on my part.
This macro does part of what I need. I need to delete the row instead of the cell.

Nori

I've been working on this database for the past 6 month. Before me, the other guy tried and could not come up with a solution. I'm just a beginner in Access and I did all my research to all my problems except this one. It look like it would be easy to delete row in Excel.
:cry:
JP
 
Upvote 0
JP

This could easily be done in Access using a simple query.

What would you want to happen to fields like quantity, size etc?
 
Upvote 0
Hi Norie

What I'm trying to get at is to eliminate duplicate row where the sch is more that once. The Qty will be the same. Every Sch represent a diferrent po.
The reference comes from column D for the heat#.
In Access, my query is a Union query to get my report, then I transfer the report to Excel to be re-format via macro and then I enter in the column remarks the location where to unload material.

Thanks for your help.
JP
 
Upvote 0
Did you try any queries based on the union query?

What exact results would you want from the posted data?

By the way why are you using a union query?

Do you have multiple tables in Access that have the same data structure?
 
Upvote 0
The query is base on the union query. What I have is 10 link tables. Data comes from another system and I get data in txt file which I link. In the original files. we have a location for railcars, but when we have to combine multiple cars together because of the same heat # in defferent cars the we use the remark line.
Railcars 11-07-2005.xls
ABCDEFGHIJ
1Railcar#CodeHeat#Std#GradeQtySchSizeLocation/Remarks
2138364QI602NW87008QI5541022MDCH15108.00
3138364QI602NW87008QI5541022MDCH15497.50
4138364QI602NW87009QI5541022MDCH28
5
6188120QI602NW87008QI5541022MDCH44108.00
7188120QI602NW87008QI5541022MDCH44497.50
8
9
10138364QI602NW87008QI5541022MDCH15497.50
11138364QI602NW87009QI5541022MDCH28
12
13188120QI602NW87008QI5541022MDCH44497.50
Railcars to unload Query


What I would like to achieve is to have the first 2 cars look like the last 2 cars.

Can you point me to the right direction?
I'm learning as I go. I have a lot to learn.

JP
 
Upvote 0
If the macro does it, replace:
if cell = cell.offset(-1,0) then cell.offset(0,3).clearcontents
with
if cell = cell.offset(-1,0) then cell.entirerow.delete
 
Upvote 0

Forum statistics

Threads
1,214,523
Messages
6,120,034
Members
448,940
Latest member
mdusw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top