I found the below google-app-script online which finds duplicates in the specified range of rows in a google spreadsheet. I need to edit this script in such a way that if the duplicates occur more than 2 times it should show those values.
This is how the script looks like:
function dups(rows) {
var values = {};
var duplicates = [];
for (var i = 0; i < rows.length; i++) {
var value = rows[i][0];
if (values[value] !== undefined && duplicates.indexOf(value) == -1) {
duplicates.push(value);
} else {
values[value] = true
}
}
return duplicates;
}
For example with this script if i type =dups(A1:A30)in any cell i get the list of unique values which are repeated more than once . But i want values which are repeated more than twice.
Thanks in advance, drc