Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default Reduce duplicates to 1 with a count of how many before

Hi Howard,

Am Tue, 25 Feb 2014 01:06:48 -0800 (PST) schrieb L. Howard:

I'll have a look at OneDrive.


you can also look for
"ScanValues"


Regards
Claus B.
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 852
Default Reduce duplicates to 1 with a count of how many before

On Tuesday, February 25, 2014 1:16:45 AM UTC-8, Claus Busch wrote:
Hi Howard,



Am Tue, 25 Feb 2014 01:06:48 -0800 (PST) schrieb L. Howard:



I'll have a look at OneDrive.




you can also look for

"ScanValues"





Regards

Claus B.

--


Hi Claus,

It looks like running MyScan5 with a call to Test_CB4 does it all.

I'll look at Scan Values too.

Thanks.

Howard
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 852
Default Reduce duplicates to 1 with a count of how many before

Hi Claus,



It looks like running MyScan5 with a call to Test_CB4 does it all.



I'll look at Scan Values too.



Thanks.



Howard


Also MyScan5 and Test_CB looks like it gets it done too.

Howard
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default Reduce duplicates to 1 with a count of how many before

Hi Howard,

Am Tue, 25 Feb 2014 01:48:37 -0800 (PST) schrieb L. Howard:

Also MyScan5 and Test_CB looks like it gets it done too.


I wrote Test_CB because I thought the values in A are unique. As you
posted another example and there are same values in A with different
values in B I found that error. So the unique values are created only
from A some values are missing. In "UniqueValues" you see that 2 values
are missing. All other macros write 9 values, CB_Test only 7.
For your data that macro is wrong.

For this case I wrote Test_CB4 and Test_CB2_2.
CB2_2 works with RemoveDuplicates and is faster.
In "ScanValues" works a combination of Scan5 and TestCB2_2


Regards
Claus B.
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 852
Default Reduce duplicates to 1 with a count of how many before

On Tuesday, February 25, 2014 1:48:37 AM UTC-8, L. Howard wrote:
Hi Claus,








It looks like running MyScan5 with a call to Test_CB4 does it all.








I'll look at Scan Values too.








Thanks.








Howard




Also MyScan5 and Test_CB looks like it gets it done too.



Howard


I looked at this "ScanValues" and I don't know what could be better?

Thanks again.

Howard



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 852
Default Reduce duplicates to 1 with a count of how many before


Hi Claus,

Because some of the serial numbers just happen to start with "P" but NO serial number will state with "P-", I made that change in the code.

That errors out this line with a subscript out of range.

arrOut(j - 1, 1) = myArr(i, 1)

I made some random changes of the -1 and the other 1's but nothing worked.


myCt = WorksheetFunction.CountIf(.Range("A1:A" & LRow), "P-" & "*")

For i = LBound(myArr) To UBound(myArr)
ReDim Preserve arrOut(myCt - 1, 1)
If Left(myArr(i, 1), 1) = "P-" Then
arrOut(j, 0) = myArr(i, 1)
j = j + 1
Else

arrOut(j - 1, 1) = myArr(i, 1)

End If
Next

Howard
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 852
Default Reduce duplicates to 1 with a count of how many before


TYPO...

<NO serial number will state with "P-",

NO serial number will START with "P-",

H'wd
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 852
Default Reduce duplicates to 1 with a count of how many before

I seem to have fixed it with the change in this line

'If Left(myArr(i, 1), 1) = "P-" Then
If Left(myArr(i, 1), 2) = "P-" Then

I would still like your opinion, however.

myArr = .Range("A1:A" & LRow)
myCt = WorksheetFunction.CountIf(.Range("A1:A" & LRow), "P-" & "*")

For i = LBound(myArr) To UBound(myArr)
ReDim Preserve arrOut(myCt - 1, 1)
'If Left(myArr(i, 1), 1) = "P-" Then
If Left(myArr(i, 1), 2) = "P-" Then
arrOut(j, 0) = myArr(i, 1)
j = j + 1
Else

arrOut(j - 1, 1) = myArr(i, 1)

End If
Next

Howard
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
count duplicates jt Excel Programming 6 April 10th 12 03:21 AM
Count Duplicates saman110 via OfficeKB.com Excel Discussion (Misc queries) 5 September 27th 07 06:04 PM
Count Employee Work Time - Don't Count Duplicates J Excel Worksheet Functions 3 May 1st 07 10:47 PM
Reduce columns and rows count? murat Excel Worksheet Functions 3 March 16th 05 07:43 PM
count a group of numbers but do not count duplicates Lisaml Excel Worksheet Functions 2 January 26th 05 11:19 PM


All times are GMT +1. The time now is 02:49 PM.

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"