Skip to content

Instantly share code, notes, and snippets.

@oshliaer
Last active June 25, 2018 14:40
Show Gist options
  • Save oshliaer/d2a1a070dda8be904d2ca81efecc4acd to your computer and use it in GitHub Desktop.
Save oshliaer/d2a1a070dda8be904d2ca81efecc4acd to your computer and use it in GitHub Desktop.
/**
* Возвращает массив сумм строк диапазонов
*
* @param {Sheet1!A1:C5} value Находит суммы строк заданного диапазона.
* @returns { *[] } Суммы строк
* @customfunction
*/
function SUMLINE(value) {
if(!Array.isArray(value))
throw new Error( "Требуется диапазон значений" );
return value.map(function(row) {
return row.reduce(function(p, c) {
return p += c;
}, 0);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment