-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogress03
More file actions
31 lines (23 loc) · 810 Bytes
/
progress03
File metadata and controls
31 lines (23 loc) · 810 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
* Progress 03
*
* A custom spreadsheet function that takes a current progress phase and returns a percentage
* from the corresponding information in the variable sheet.
*/
function progress3(a){
// default output for when percentage cannot be found
var output = "Error";
// variable sheet and data location
var varSheet = SpreadsheetApp.getActive().getSheetByName("Variables");
var progress = 3;
var percent = 4;
var progressData = varSheet.getRange(1, progress, varSheet.getLastRow(), 1).getValues();
var percentData = varSheet.getRange(1, percent, varSheet.getLastRow(), 1).getValues();
// find corresponding percentage
for(var dat in progressData){
if(progressData[dat][0] == a){
output = percentData[dat][0];
}
}
return output;
}