Add only unique nos in a column

hsandeep

Well-known Member
Joined
Dec 6, 2008
Messages
1,215
Office Version
  1. 2010
Platform
  1. Windows
  2. Mobile
in column C5:C9999, i have values appearing as

40, 50, 60, 50, 60, 40, 40
I want total of 'unique appearance' no.
How to accomplish?
Answer for above is: 40+50+60=150
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Maybe

C D (headers in row 4)
NumbersSum Unique
40150
50
60
50
60
40
40

<colgroup><col style="width: 48pt;" width="64"> <col style="width: 62pt; mso-width-source: userset; mso-width-alt: 2998;" width="82"> <tbody>
</tbody>


Formula in D5
=SUMPRODUCT(--(MATCH($C$5:$C$11,$C$5:$C$11,0)=ROW($C$5:$C$11)-ROW($C$5)+1),$C$5:C11)

M.
 
Upvote 0
in column C5:C9999, i have values appearing as

40, 50, 60, 50, 60, 40, 40
I want total of 'unique appearance' no.
How to accomplish?
Answer for above is: 40+50+60=150

Control+shift+enter, not just enter:
Rich (BB code):
=SUM(IF(FREQUENCY(IF(ISNUMBER(C5:C9999),MATCH(C5:C9999,C5:C9999,0)),
     ROW(C5:C9999)-ROW(C5)+1),C5:C9999))
 
Upvote 0
If you do not have empty spaces:
Excel 2010
ABC
1DataResult
220140
320
420
540
640
740
840
980
1080

<colgroup><col style="width: 25pxpx"><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1



Array Formulas
CellFormula
C2{=SUM(IF(FREQUENCY(A2:A10,A2:A10),A2:A10))}

<thead>
</thead><tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>

Adjust your ranges.
 
Upvote 0
Branco, Aladin & Mika: Thanks. The formula WORKS. Branco's formula is SUPERB.
 
Upvote 0
If you have non-numbers, empty cells or blanks, only the formula I suggested will work...

Aladin,
Yes, I have non-numbers, nulls or blanks. So I am using your formula.
Please, Can I also get the no. of 'unique appearances'?
for 40, 50, 60, 50, 60, 40, 40
Answer=3
Part B) Also how to accomplish:
40 3
50 2
60 2
 
Upvote 0
Aladin,
Yes, I have non-numbers, nulls or blanks. So I am using your formula.
Please, Can I also get the no. of 'unique appearances'?
for 40, 50, 60, 50, 60, 40, 40
Answer=3
Part B) Also how to accomplish:
40 3
50 2
60 2

40 Unique SumUnique Count
50 1503
60 Unique ListOccurrence Frequency
50 403
502
60 602
40
40

<colgroup><col style="width: 48pt;" span="2" width="64"> <col style="width: 109pt; mso-width-source: userset; mso-width-alt: 5176;" width="146"> <col style="width: 130pt; mso-width-source: userset; mso-width-alt: 6172;" width="174"> <tbody>
</tbody>


The data is C5:C9999 on Sheet1 (Adjust to suit if necessary).

Define Ivec (of Integer Vector) using Insert | Name | Define or Formulas | Name Manager as referring to:
Rich (BB code):
=ROW(Sheet1!$C$5:$C$9999)-ROW(Sheet1!$C$5)+1

E5, control+shift+enter, not just enter:
Rich (BB code):
=SUM(IF(FREQUENCY(IF(ISNUMBER(C5:C9999),MATCH(C5:C9999,C5:C9999,0)),Ivec),C5:C9999))
This sums the distinct (unique) numbers in the target range.
F5, control+shift+enter, not just enter:
Rich (BB code):
=SUM(IF(FREQUENCY(IF(ISNUMBER(C5:C9999),MATCH(C5:C9999,C5:C9999,0)),Ivec),1))
If we want to count any distinct value, numeric or text, we change the ISNUMBER bit:
Rich (BB code):
=SUM(IF(FREQUENCY(IF(C5:C9999<>"",MATCH(C5:C9999,C5:C9999,0)),Ivec),1))
E8, control+shift+enter and copy down:
Rich (BB code):
=IF(ROWS($E$3:E3)<=$F$6,INDEX($C$5:$C$9999,
  SMALL(IF(FREQUENCY(IF(ISNUMBER($C$5:$C$9999),MATCH($C$5:$C$9999,$C$5:$C$9999,0)),
   Ivec),Ivec),ROWS($E$3:E3))),"")
If we want to list any distinct value, numeric or text, we replace the ISNUMBER bit...
Rich (BB code):
=IF(ROWS($E$3:E3)<=$F$6,INDEX($C$5:$C$9999,
  SMALL(IF(FREQUENCY(IF($C$5:$C$9999<>"",MATCH($C$5:$C$9999,$C$5:$C$9999,0)),
   Ivec),Ivec),ROWS($E$3:E3))),"")
F8, just enter and copy down:
Rich (BB code):
=IF($E8="","",COUNTIF($C$5:$C$9999,$E8))
 
Upvote 0
E8, control+shift+enter and copy down:
Code:
[SIZE=2][FONT=lucida console]=IF(ROWS($E$3:E3)<=$F$6,INDEX($C$5:$C$9999,
  SMALL(IF(FREQUENCY(IF(ISNUMBER($C$5:$C$9999),MATCH($C$5:$C$9999,$C$5:$C$9999,0)),
   Ivec),Ivec),ROWS($E$3:E3))),"")[/FONT][/SIZE]

I am trying to copy this formula using CTRL + C but it is coming in 3 rows.  How to copy the formula?
 
Upvote 0
E8, control+shift+enter and copy down:
Code:
[SIZE=2][FONT=lucida console]=IF(ROWS($E$3:E3)<=$F$6,INDEX($C$5:$C$9999,
  SMALL(IF(FREQUENCY(IF(ISNUMBER($C$5:$C$9999),MATCH($C$5:$C$9999,$C$5:$C$9999,0)),
   Ivec),Ivec),ROWS($E$3:E3))),"")[/FONT][/SIZE]

I am trying to copy this formula using CTRL + C but it is coming in 3 rows.  How to copy the formula?[/QUOTE]

After you type the formula in E8, apply immediately control+shift+enter (CSE). Then drag it down as you would a non-CSE formula.
 
Upvote 0

Forum statistics

Threads
1,216,077
Messages
6,128,685
Members
449,463
Latest member
Jojomen56

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