Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 239
Default How to find duplicate column (not the cell values)

I am receiving a file daily which contains lots of columns.
Some times, file contains same column twice.
I need to check and remove the whole column which is repeated.
I only need to check col headings in row 1 for duplicates and not the entire column data.

Pl help.

Regards,
Madiya.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default How to find duplicate column (not the cell values)

Hi,

Am Thu, 13 Jun 2013 02:04:51 -0700 (PDT) schrieb Madiya:

I am receiving a file daily which contains lots of columns.
Some times, file contains same column twice.
I need to check and remove the whole column which is repeated.
I only need to check col headings in row 1 for duplicates and not the entire column data.


your headers in A1:Z1.
Then try for column number:
=MODE(IF(A1:Z1<"",MATCH(A1:Z1,A1:Z1,)))

or for the header:
=INDEX(A1:Z1,MODE(IF(A1:Z1<"",MATCH(A1:Z1,A1:Z1,) )))

Both formulas are array formulas to enter with CTRL+Shift+Enter


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 239
Default How to find duplicate column (not the cell values)

On Thursday, 13 June 2013 14:34:51 UTC+5:30, Madiya wrote:
I am receiving a file daily which contains lots of columns.

Some times, file contains same column twice.

I need to check and remove the whole column which is repeated.

I only need to check col headings in row 1 for duplicates and not the entire column data.



Pl help.



Regards,

Madiya.


Claus,
Thanks for reply.
I have tried it and it gives me name of 1st duplicate column. If there is more duplicate column, I will not know it unless rest of the macro execution throws error.

Also it will be more helpfull if solution is in vba so that a msgbox can be desplayed with each duplicate column name.

I am expecting 3 to 5 duplicate columns in general.

Thanks again.

Regards,
Madiya
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default How to find duplicate column (not the cell values)

Hi Madiya,

Am Thu, 13 Jun 2013 02:35:01 -0700 (PDT) schrieb Madiya:

I have tried it and it gives me name of 1st duplicate column. If there is more duplicate column, I will not know it unless rest of the macro execution throws error.

Also it will be more helpfull if solution is in vba so that a msgbox can be desplayed with each duplicate column name.

I am expecting 3 to 5 duplicate columns in general.


then try:

Sub DuplicateTest()
Dim rngC As Range
Dim myStr As String

For Each rngC In Range("A1:Z1")
If WorksheetFunction.CountIf(Range(Cells(1, 1), _
rngC), rngC) 1 Then
myStr = myStr & rngC.Value & " " & _
rngC.Address(0, 0) & Chr(10)
End If
Next
MsgBox myStr
End Sub


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
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
how to find duplicate values in a column during enter the value? kesav Excel Discussion (Misc queries) 0 July 18th 08 06:37 AM
Find duplicate values in column K then compare cells range of dups jonnybrovo815 Excel Programming 0 July 25th 07 07:52 PM
Find right cell (with duplicate values) leonidas[_68_] Excel Programming 0 August 4th 06 04:19 PM
find a cell matching separate column and row values LQEngineer Excel Worksheet Functions 2 July 26th 06 07:10 AM
Find Empty Column and paste cell values Mike Excel Programming 6 December 28th 03 08:31 PM


All times are GMT +1. The time now is 07:39 AM.

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

About Us

"It's about Microsoft Excel"