Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Advance handling with duplicates

most of the code and help is on removing duplicates. however, my problem is
that my duplicates data occur becos my other dept key in data w/o a standard
format and we can not make changes to the main data sheet except to sort it
out to other sheet ourself.I will need to combine data from both duplicates
into one data.

Illustration:

orginal data:
Name Jan Feb March
alan 0 0 1
alan 1 0 0

what i want in the end:
Name Jan Feb March
alan 1 0 1
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Advance handling with duplicates

Sub Test()
Dim iLastRow As Long
Dim iLastCol As Long
Dim i As Long, j As Long
Dim rng As Range

Application.ScreenUpdating = False

iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
iLastCol = Cells(1, Columns.Count).End(xlToLeft).Column
For i = 1 To iLastRow
If Cells(i, "A").Value = Cells(i + 1, "A").Value Then
For j = 2 To iLastCol
Cells(i + 1, j).Value = Cells(i + 1, j).Value + _
Cells(i, j).Value
If rng Is Nothing Then
Set rng = Rows(i)
Else
Set rng = Union(rng, Rows(i))
End If
Next j
End If
Next i

If Not rng Is Nothing Then rng.Delete

End Sub

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"violet" wrote in message
...
most of the code and help is on removing duplicates. however, my problem

is
that my duplicates data occur becos my other dept key in data w/o a

standard
format and we can not make changes to the main data sheet except to sort

it
out to other sheet ourself.I will need to combine data from both

duplicates
into one data.

Illustration:

orginal data:
Name Jan Feb March
alan 0 0 1
alan 1 0 0

what i want in the end:
Name Jan Feb March
alan 1 0 1



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Advance handling with duplicates

hi,but i still got a problem. i don't want all the colunm to be add up..only
for selected column. in addition, i gt null value in the column where i need
to check for duplicates.i will like the row with null in value in that column
to remain w/o any changes. so how can i do it?

"Bob Phillips" wrote:

Sub Test()
Dim iLastRow As Long
Dim iLastCol As Long
Dim i As Long, j As Long
Dim rng As Range

Application.ScreenUpdating = False

iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
iLastCol = Cells(1, Columns.Count).End(xlToLeft).Column
For i = 1 To iLastRow
If Cells(i, "A").Value = Cells(i + 1, "A").Value Then
For j = 2 To iLastCol
Cells(i + 1, j).Value = Cells(i + 1, j).Value + _
Cells(i, j).Value
If rng Is Nothing Then
Set rng = Rows(i)
Else
Set rng = Union(rng, Rows(i))
End If
Next j
End If
Next i

If Not rng Is Nothing Then rng.Delete

End Sub

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"violet" wrote in message
...
most of the code and help is on removing duplicates. however, my problem

is
that my duplicates data occur becos my other dept key in data w/o a

standard
format and we can not make changes to the main data sheet except to sort

it
out to other sheet ourself.I will need to combine data from both

duplicates
into one data.

Illustration:

orginal data:
Name Jan Feb March
alan 0 0 1
alan 1 0 0

what i want in the end:
Name Jan Feb March
alan 1 0 1




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
An Advance IF Manos Excel Worksheet Functions 3 October 2nd 08 02:54 PM
I need a little help...thanks in advance Jambruins Excel Discussion (Misc queries) 1 August 3rd 05 06:00 PM
Here's one for you...(thanks for the help in advance) Jambruins Excel Discussion (Misc queries) 2 July 15th 05 07:41 PM
Error handling with a handling routine ben Excel Programming 0 March 15th 05 03:01 PM
Help Please! Thanks in advance. Derek Richards Excel Programming 7 October 23rd 03 06:25 PM


All times are GMT +1. The time now is 02:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"