• Status: Solved
• Priority: Medium
• Security: Public
• Views: 119

# excel column find duplicate count and compare value

I need a formula, please see sample screenshot, my raw data contain in single column

0
Julio Jose
• 9
• 9
• 5
• +2
3 Solutions

Commented:
Hi,

pls try

``````=Countif(A:A,B2)
``````

and

``````=if(Countif(D:D;B2),TRUE,FALSE)
``````

Regards
0

Excel & VBA ExpertCommented:
Please refer to the attached for all the formulas.
Julio.xlsx
0

Commented:
If  column A is RAW and Row 1 is RAW
For the count, in C2 type =COUNTIF(\$A\$2:\$A\$12;B2) - if you are in the US type in
=COUNTIF(\$A\$2:\$A\$12,B2)
and copy down the formula to C3

and for the compare type in E2 and copy down the following
=IF(ISERROR(VLOOKUP(D2;\$A\$2:\$A\$12;1;FALSE));FALSE;TRUE)
or in the US
=IF(ISERROR(VLOOKUP(D2,\$A\$2:\$A\$12,1,FALSE)),FALSE,TRUE)

See my sample file attached
example.xlsx
0

Finance AnalystCommented:
You can also achieve the same with Pivot Table functions. Also by converting the list to a table, the Pivot range will expand as the data expands.

The List of unique entries and the count of each is a Pivot Table. The compare columns then use the GETPIVOTDATA function within an ISERROR function. If the criterion specified for GETPIVOTDATA don't exist in the Pivot, it will give an error. By reversing that with a NOT function, you get the desired results.

See attached.

Thanks
Rob H
Pivot.xlsx
0

Author Commented:
Can column B get the unique value in the column A use formula
0

Commented:
You can use an INDEX/MATCH combination
In the attached example I have named the RAW list of fruit (A2:A12) and used Ctrl+Shift+Enter to enter the formula in B2, and copy B2 down to B3:B12.
example_v2.xlsx
0

Finance AnalystCommented:
In the file I uploaded, just delete column E and then delete column B.

It then has the format/layout the same as your screenshot.

Thanks
Rob
0

Excel & VBA ExpertCommented:
Can column B get the unique value in the column A use formula
The file I uploaded in Post ID: 41748755, the column B already contains a formula to show the unique values from column A. :)
0

Author Commented:
The column A actually contain 459 row data, I tested the formula not work
0

Excel & VBA ExpertCommented:
You will need to adjust the ranges in the formula as the sample workbook I uploaded assumed that you have only 12 rows of data.

If you have 459 rows of data, you may try the formulas like this...

To get unique entries in col. B.
Try this Array Formula which requires confirmation with Ctrl+Shift+Enter instead of Enter alone. i.e. copy the formula given below --> delete the existing formula from B2 --> press F2 (function key) to go in edit mode --> paste the copied formula but don't hit Enter now --. hold down the Ctrl + Shift keys together and then hit Enter.

In B2
``````=IFERROR(INDEX(\$A\$2:\$A\$459,MATCH(0,INDEX(IF(\$A\$2:\$A\$459<>"",COUNTIF(\$B\$1:B1,\$A\$2:\$A\$459)),0,0),0)),"")
``````
and then copy the formula down until you get blank cells.

To count for occurrences of each unique entry in col. B.
Try this.....
In C2
``````=COUNTIF(\$A\$2:\$A\$459,B2)
``````
and then copy it down.

In E2
``````=ISNUMBER(MATCH(D2,\$A:\$A,0))
``````
and then copy down.

0

Finance AnalystCommented:
Setting the list as table and then usingva pivot table, it doesn't matter how many rows of data; just refresh the pivot and it will include the new data.
0

Author Commented:
Subodh, sample data attached
0

Excel & VBA ExpertCommented:
I think you forgot to upload it. :)
0

Author Commented:
0

Excel & VBA ExpertCommented:
Julio1.xlsx
0

Commented:
check out your file with example of unique items
named the data in column A as a named ranged - RAW and used that in your formulas for easier reference
Julio1_wUniques.xlsx
0

Finance AnalystCommented:
Updated version using a pivot and GETPIVOTDATA function.
Pivot.xlsx
0

Author Commented:
when I replace the column A with my actual data, the column B does't show the accurate information
0

Finance AnalystCommented:
To who was that comment addressed - which solution, formula or pivot table???
0

Author Commented:
Rob, I tried both the same
0

Finance AnalystCommented:
With the new data in column A, select a cell in column B and right click, choose Refresh from the pop up menu.

Or when in the pivot table there will be extra tabs on the ribbon for Pivot Table Tools. The tab for Options will have a Refresh button.

If you are just pasting your existing data on top of what is already there, the extent of the Table may not be expanding correctly. Before pasting, choose a cell in column A and you will have an additional ribbon group for Table Tools with one tab Design. On this tab over to the left there is an option for "Convert to Range". Click this and then paste in your new real data.

Then select all of the data in column A and press Ctrl + T to start the create Table wizard. The range should already be populated but ensure you check the box for "My data has headers" and then OK.

This will however rename the Table in sequence, Table1, Tabl2 etc. The Table Design tab will have re-appeared, in the top left there is an input box to rename the Table, rename it as Table1 and the Pivot should refresh correctly.

You will not have to do this everytime, as you add new data to the bottom of the list it will expand the table and the Pivot Table will refresh properly.

Thanks
Rob H
0

Author Commented:
I'm lost in "Convert to Range", using Excel 2007
0

Finance AnalystCommented:
OK, I am using Excel 2010; I don't recall where that option was in 2007.

Another option attached.

Similar to suggested by xtermie with a Named Range, but the named range is Dynamic so that it changes as the data expands.

Pivot Table on second sheet is based on data in Named Range rather than Table1.
Pivot.xlsx
0

Author Commented:
don't understand what is the problem, paste 10 then refresh I got a accurate data but paste 100 is getting wrong again.
0

Commented:
In my case can you also update the named range RAW to be the new data range in A?
Also could you please sort column A?

Check attachment
Julio1_wUniques_vo.xlsx
0

Finance AnalystCommented:
Are you pasting into Dynamic sheet or Pivot sheet?

If pasting into Dynamic sheet, there should be no problem; whereas Pivot sheet will have the issue of resetting the Table1 as described above.

Did you find the Table conversion settings for 2007? At some point it used to be referred to as a List but I thought that was 2003 and prior.

Thanks
Rob
0

Finance AnalystCommented:
Just Googled converting table to range in 2007 and found this on theexceladdict.com

Convert Excel 2007 Table To A Normal Range:
1) Right-click any cell within the table;
2) On the pop-up menu point to Table, then Convert to Range. You will be asked to confirm your action with a message “Do you want to convert the table to a normal range?“

Thanks
Rob
0

Author Commented:
thank you all
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.