I have a list in SharePoint 2013

For example

  • In Row 1: Column1 has 12 and Column2 has blackberry as values
  • In Row 2: Column1 has 34 and Column2 has iphone as values
  • In Row 3: Column1 has 12 and Cloumn2 has blackberry as values

Now I want to display rows which has duplicate values. I want to create a view which shows only rows 1 and 3 which are duplicates.

  • 1
    As ListItems have no relationship with eachother you can't use data from multiple rows in a Filter. You could use ClientSideRendering code to preprocess a View and Hide items. Commented Oct 8, 2015 at 11:10
  • Create a view that groups by column 2? It won't get you fully there, but it will show "duplicates" in that they are grouped together. Commented Oct 8, 2015 at 11:13
  • If i use group by in view then it will show both duplicates and non duplicates. I want to see only duplicates in my view. Can this be done using custom view. If so the how to do that?
    – kats
    Commented Oct 8, 2015 at 11:31

1 Answer 1


Nice challenge for Out Of the Box thinking where there are no Out of the Box answers

Programmers approach would we to use Two Loops

  • One to loop all items and count the double ones
  • And loop all items again to display an item or not

You can use Client Side Rendering for that; if you do all processing first you can built the HTML before it is displayed in the browser.

See: Displaying list with only unique values in title column


you have to code some 30 lines of boilerplate code.. AND attach a JSlink to **every View* you want to use it.

If you don't mind a flash (displayed content is erased)

Out of the box with NO loops

.. well.. strictly speaking one loop... the original SharePoint code displaying a whole View

You can make each ListItem count itself and then check if its total count is > 1

In A Calculated Column (set to datatype=Number)

which executes some cute JavaScript(I haven't tested all browsers, works in Chrome and IE10)

Paste the Formula:

="<img src=/_layouts/images/blank.gif onload=""{"
&"var C,v='count_"
&[Task Name]
  • Each item displays a blank IMG to trigger JavaScript code (the SCRIPT tag is disabled by Microsoft)
  • You can then built a JavaScript variable v with the value you want to check doubles for

Since this code is always executed for every ListItem we need some special bookkeeping of Global variables

  • we check if a Global variable (object) cnt exists, use it or declare it (once) as a new object
  • we check if the value exists in the cnt object (a previous occurence) or set the counter to 0
  • then always add 1 to the count

At this stage you could hide double values if the counter is >1 .. but you want the reverse, so it is essential we count all items first.

  • _spYield (declared in SP.js, but you won't find any blogs or documentation) makes JavaScript execution wait (something not possible out of the box with JavaScript)

We need this wait/delay because IMGs are loaded async, thus this code as well and we want to make sure all ListItems are processed/counted.. a yield/Wait of 1 millisecond seems to be enough

So once all ListItems are counted they execute their own function

  • the executed function sets the display based on the counter,
    • if the counter==1 we pick the 0th value in the text-array (hide)
    • otherwise the 1th value (leave double values displayed)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.