Unique entries for average

dmacmillan

Board Regular
Joined
Apr 5, 2004
Messages
125
Hi,

This is a continuation of an earlier post as the two helpful respondents are offline ...

I am at this point:

=SUM(IF(FREQUENCY(IF(A7:A10000<>"",MATCH("~"&A7:A10000,A7:A10000&"",0)),ROW(A7:A10000)-ROW(A7)+1),1))

It functions well but I have to insert more conditions. Specifically:

1. Not only does A7:A100000 have to be "" but a particular type of entry ("NOJOB") must be excluded also. I tried IF(AND(A7:A10000<>"",A7:A10000<>"NOJOB"),MATCH ... without luck; and

2. Additional conditions in, say columns B, C and D, need to be accounted for.

Welcome assistance/comments.

Thank you in advance,
David
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Hi,

This is a continuation of an earlier post as the two helpful respondents are offline ...

I am at this point:

=SUM(IF(FREQUENCY(IF(A7:A10000<>"",MATCH("~"&A7:A10000,A7:A10000&"",0)),ROW(A7:A10000)-ROW(A7)+1),1))

It functions well but I have to insert more conditions. Specifically:

1. Not only does A7:A100000 have to be "" but a particular type of entry ("NOJOB") must be excluded also. I tried IF(AND(A7:A10000<>"",A7:A10000<>"NOJOB"),MATCH ... without luck; and

2. Additional conditions in, say columns B, C and D, need to be accounted for.

Welcome assistance/comments.

Thank you in advance,
David
Try...
Code:
=SUM(IF(FREQUENCY(
   IF(A7:A10000<>"",
   IF(A7:A10000<>"NOJOB",
     MATCH("~"&A7:A10000,A7:A10000&"",0))),
      ROW(A7:A10000)-ROW(A7)+1),1))

If you would want to add an equality test involving the range in B, say, B = "JAD"...
Code:
=SUM(IF(FREQUENCY(
    IF(A7:A10000<>"",
    IF(A7:A10000<>"NOJOB",
    IF(B7:B10000="JAD",
      MATCH("~"&A7:A10000,A7:A10000&"",0)))),
       ROW(A7:A10000)-ROW(A7)+1),1))

Note 1. If you are not on Excel 2007 or later, you have to take the limit
for nesting levels into account.
Note 2. More IFs also mean degradation in performance. You can avoid this in part
by creating a range say in E that concatenates A, B, C, and D if appropriate to do so.
Note 3. For better performance, you could switch to SQL.
 
Upvote 0
Aladin,

Thank you for coming to the party once again. I had investigated your SQL solution but found the Array solution quick enough, certainly quicker than the SUMPRODUCT option in my earlier post. If nesting IFs markedly slows calculation, I will pursue SQL.

Kind regards,
David
 
Upvote 0
Aladin,

Thank you for coming to the party once again. I had investigated your SQL solution but found the Array solution quick enough, certainly quicker than the SUMPRODUCT option in my earlier post. If nesting IFs markedly slows calculation, I will pursue SQL.

Kind regards,
David

You are welcome. Thanks for providing feedback.
 
Upvote 0

Forum statistics

Threads
1,224,603
Messages
6,179,850
Members
452,948
Latest member
UsmanAli786

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