Created
May 30, 2016 04:28
-
-
Save dhilipsiva/a06086ca80ad9f54fa0afd2e0b57b8fc to your computer and use it in GitHub Desktop.
This is Google Sheet custom scripts to get total stats.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This is Google Sheet custom scripts to get total stats. | |
*/ | |
function BFCOUNT(range) { | |
var ss = SpreadsheetApp.getActive(); | |
var numRows = range.length; | |
var items = {}; | |
for (var key in range) { | |
if (range.hasOwnProperty(key)) { | |
item = range[key]; | |
var oldVal = items[item] | |
if( oldVal === undefined){ | |
oldVal = 0; | |
} | |
items[item] = oldVal + 1; | |
} | |
} | |
var strItem = ""; | |
for(var item in items){ | |
count = items[item]; | |
strItem += item + ": " + count + "\n"; | |
} | |
return strItem; | |
} | |
function LUNCHCOUNT(range) { | |
var ss = SpreadsheetApp.getActive(); | |
var numRows = range.length; | |
var count = 0; | |
for (var key in range) { | |
if (range.hasOwnProperty(key)) { | |
item = range[key]; | |
if(item == "Yes"){ | |
count+=1; | |
} | |
} | |
} | |
return count; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment