Need help to create formula to Filter Unique

JV0710

Active Member
Joined
Oct 26, 2006
Messages
429
Office Version
  1. 365
  2. 2016
  3. 2013
Platform
  1. Windows
Hi

Please help . . .

In the example shown I am trying to use a formula in column D to create a list of unique colours that apear in column A - As can be seen I am getting it right to show the unique colurs but I would the result to be like the info in column F ( Like filter unique ).

The formula I am using in the cells in column D is :

=IF(AND(COUNTIF(A4:$A$25,A3)=0,COUNTIF($D$2:D2,A3)=0),A3,IF(AND(COUNTIF(A4:$A$25,A3)>=0,COUNTIF($D$2:D2,A3)=0),A3,IF(AND(COUNTIF(A4:$A$25,A3)>0,COUNTIF($D$2:D2,A3)>0)," ",IF(AND(COUNTIF(A4:$A$25,A3)=0,COUNTIF($D$2:D2,A3)>0)," "))))

I am getting circular reference when I try to change the formula:

Thanks.
Unique values in a list.xls
ABCDEF
1
2
3RedRedRed
4greengreengreen
5red blue
6red yellow
7blueblueblack
8blue white
9red 
10yellowyellow
11blackblack
12whitewhite
13red 
14
15
Sheet1
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Here you go with one possible way:
Book1
ABCD
1RedRedRed
2greengreengreen
3redblueblue
4redyellowyellow
5blueblackblack
6bluewhitewhite
7red#N/A 
8yellow#N/A 
9black#N/A 
10white#N/A 
11red#N/A 
Sheet1


Formula in B2 and below is:

Code:
=INDEX($A$1:$A$11,MATCH(0,COUNTIF(B$1:B1,$A$1:$A$11),0))

it is an array formula and so must be entered with Ctrl+Shift+Enter.

Formula in C2 (which is an alternative so that #N/A doesn't appear) is:

Code:
=IF(ISNA(INDEX($A$1:$A$11,MATCH(0,COUNTIF(C$1:C1,$A$1:$A$11),0))),"",INDEX($A$1:$A$11,MATCH(0,COUNTIF(C$1:C1,$A$1:$A$11),0)))

likewise an array formula.

Note that the two formulas in colB and colC are entirely independent ie you don't need colB to use colC.
 
Upvote 0
I have a follow-up question to this problem.

First, what I'm trying to do: I create a weekly pivot table that summarizes the quantity sold and the average price per pound, so it is a weighted average. The totals provided by the pivot table are average prices, but not a weighted average, so the number is not actually that usefull. For example, if we sold 20 lbs at $5/lb and 10 lbs at $10/lb it shows the average price of $7.50, but I want it to show $6.67.

Second, my partial solution: We have multiple categories that I would like to subtotal, the categories have varying numbers of items in them and we don't use every category every week. So I am currently adding rows at the end of my data and using sumifs to find the weighted average.

Is it possible to have the list of unique values continue at the bottom of the list it is summarizing, or is there a better way to get the pivot table to give me the information I want? Oh, and I do someother manipulating of the data in a macro, so if you can help me with the VBA code, that would be super great.

Thanks in advance!!
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,338
Messages
6,124,360
Members
449,155
Latest member
ravioli44

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