A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Counting Unique entry from Concatenated list



 
 
Thread Tools Display Modes
  #21  
Old January 3rd, 2007, 08:28 PM posted to microsoft.public.excel.worksheet.functions
Rajat
external usenet poster
 
Posts: 32
Default Counting Unique entry from Concatenated list

Dear Ron Rosenfeld

I've a problem in this formula also, following formula return value 1 when
cell is blank cell A1 value nil as a result of CONCATENATE function i used in
cell A1

=COUNTDIFF(ARRAY.JOIN(REGEX.MID(A1,"[^,]+",INTVECTOR(REGEX.COUNT(A1,"[^,]+"),1))))

When Cell A Contain - Formula Result
Roy,Roy,b,c - 3
Roy,,, - 1
,,,, - 1

in Cell A i used formula =CONCATENATE(Z1,Y1,X1,K1)
Is there any other work around?

Regards

Rajat
  #22  
Old January 3rd, 2007, 08:35 PM posted to microsoft.public.excel.worksheet.functions
Rajat
external usenet poster
 
Posts: 32
Default Counting Unique entry from Concatenated list

another point i forgot to mention after entering the last formula in the cell
a Msg Box appear which is as follows -

Title : Microsofy Visual Basic
Body Message : User-defined type not defined
Button : Ok , Help

is the formula problem is due to this or any other matter? Hope that you can
solve it.

regards

Rajat
  #23  
Old January 3rd, 2007, 10:01 PM posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld
external usenet poster
 
Posts: 3,719
Default Counting Unique entry from Concatenated list

On Wed, 3 Jan 2007 12:28:02 -0800, Rajat wrote:

Dear Ron Rosenfeld

I've a problem in this formula also, following formula return value 1 when
cell is blank cell A1 value nil as a result of CONCATENATE function i used in
cell A1

=COUNTDIFF(ARRAY.JOIN(REGEX.MID(A1,"[^,]+",INTVECTOR(REGEX.COUNT(A1,"[^,]+"),1))))

When Cell A Contain - Formula Result
Roy,Roy,b,c - 3
Roy,,, - 1
,,,, - 1

in Cell A i used formula =CONCATENATE(Z1,Y1,X1,K1)
Is there any other work around?

Regards

Rajat


What is happening:

When the REGEX returns nothing, as it will if A1 is empty, then the ARRAY.JOIN
returns a #VALUE! error. COUNTDIFF then counts that as one unique entry.

To correct that problem, we will exclude the #VALUE! error from being counted:

=COUNTDIFF(ARRAY.JOIN(REGEX.MID(A1,"[^,]+",
INTVECTOR(REGEX.COUNT(A1,"[^,]+"),1))),,#VALUE!)

The formula will now return a 0.


--ron
  #24  
Old January 3rd, 2007, 10:02 PM posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld
external usenet poster
 
Posts: 3,719
Default Counting Unique entry from Concatenated list

On Wed, 3 Jan 2007 12:35:03 -0800, Rajat wrote:

another point i forgot to mention after entering the last formula in the cell
a Msg Box appear which is as follows -

Title : Microsofy Visual Basic
Body Message : User-defined type not defined
Button : Ok , Help

is the formula problem is due to this or any other matter? Hope that you can
solve it.

regards

Rajat


I cannot reproduce this error message. Perhaps more detail?


--ron
  #25  
Old January 3rd, 2007, 11:03 PM posted to microsoft.public.excel.worksheet.functions
Harlan Grove
external usenet poster
 
Posts: 520
Default Counting Unique entry from Concatenated list

Ron Rosenfeld wrote...
....
To correct that problem, we will exclude the #VALUE! error from being counted:

=COUNTDIFF(ARRAY.JOIN(REGEX.MID(A1,"[^,]+",
INTVECTOR(REGEX.COUNT(A1,"[^,]+"),1))),,#VALUE!)

....

An alternative would be to prevent the error. One option, which
excludes empty fields and returns 0 for blank cells or cells evaluating
to "",

=COUNTDIFF(EVAL("{"""&SUBSTITUTE(A1,",",""",""")&" ""}"),,"")

And an alternative regex formula would be

=COUNTDIFF(REGEX.MID(A1&",","[^,]+",INTVECTOR(REGEX.COUNT(A1&",,",","),1)),,"")

But maybe the direct approach makes more sense.

=IF(WORDCOUNT(A1,","),COUNTDIFF(REGEX.MID(A1,"[^,]+",
INTVECTOR(WORDCOUNT(A1,","),1))),0)

  #26  
Old January 3rd, 2007, 11:11 PM posted to microsoft.public.excel.worksheet.functions
Harlan Grove
external usenet poster
 
Posts: 520
Default Counting Unique entry from Concatenated list

Harlan Grove wrote...
....
But maybe the direct approach makes more sense.

=IF(WORDCOUNT(A1,","),COUNTDIFF(REGEX.MID(A1,"[^,]+",
INTVECTOR(WORDCOUNT(A1,","),1))),0)


Failed to test that with a single field in A1. Make that

=IF(WORDCOUNT(A1,",")2,WORDCOUNT(A1,","),
COUNTDIFF(REGEX.MID(A1,"[^,]+",INTVECTOR(WORDCOUNT(A1,","),1))))

  #27  
Old January 4th, 2007, 01:07 AM posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld
external usenet poster
 
Posts: 3,719
Default Counting Unique entry from Concatenated list

On 3 Jan 2007 15:03:28 -0800, "Harlan Grove" wrote:

Ron Rosenfeld wrote...
...
To correct that problem, we will exclude the #VALUE! error from being counted:

=COUNTDIFF(ARRAY.JOIN(REGEX.MID(A1,"[^,]+",
INTVECTOR(REGEX.COUNT(A1,"[^,]+"),1))),,#VALUE!)

...

An alternative would be to prevent the error. One option, which
excludes empty fields and returns 0 for blank cells or cells evaluating
to "",

=COUNTDIFF(EVAL("{"""&SUBSTITUTE(A1,",",""",""")& """}"),,"")

And an alternative regex formula would be

=COUNTDIFF(REGEX.MID(A1&",","[^,]+",INTVECTOR(REGEX.COUNT(A1&",,",","),1)),,"")

But maybe the direct approach makes more sense.

=IF(WORDCOUNT(A1,","),COUNTDIFF(REGEX.MID(A1,"[^,]+",
INTVECTOR(WORDCOUNT(A1,","),1))),0)



All work. I'd still like to see COUNTDIFF return a 1 with a single element not
enclosed in an array constant.


--ron
  #28  
Old January 4th, 2007, 04:12 AM posted to microsoft.public.excel.worksheet.functions
Rajat
external usenet poster
 
Posts: 32
Default Counting Unique entry from Concatenated list

Now its not showing on my sheet, After i added the ARRAY.JOIN part of the
formulae this message box was shown. Thanx for your help once again.

Regards
Rajat

"Ron Rosenfeld" wrote:

On Wed, 3 Jan 2007 12:35:03 -0800, Rajat wrote:

another point i forgot to mention after entering the last formula in the cell
a Msg Box appear which is as follows -

Title : Microsofy Visual Basic
Body Message : User-defined type not defined
Button : Ok , Help

is the formula problem is due to this or any other matter? Hope that you can
solve it.

regards

Rajat


I cannot reproduce this error message. Perhaps more detail?


--ron

  #29  
Old January 4th, 2007, 04:18 AM posted to microsoft.public.excel.worksheet.functions
Rajat
external usenet poster
 
Posts: 32
Default Counting Unique entry from Concatenated list

Dear Harlan and Ron

Thanks a lot for providing the formulae, both the formula worked well
without any problem.

Regards

Rajat



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:14 AM.


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