1

I have a Google Sheets spreadsheet (sheet 1) which I use as source for a function to split a row into several rows in a results worksheet (sheet 2).
The split function divides the row when it finds commas in column F.
https://docs.google.com/spreadsheets/d/1e0YhJqHn62jju7KOOy5U2JZ5FLCv6_oeY-mc_jRF5-4/edit?usp=sharing
I'd like to split the time duration in column O by the number of splits performed by the function in column F and this way calculate the accurate time spent in each operation.

Source sheet: source sheet

Results worksheet: results sheet

Function:

function extract(range, colToSplit, delimiter) {
var resArr = [], row;
range.forEach(function (r) {
    r[colToSplit-1].replace(/(?:\r\n|\r|\n)(\d|\w)/g," , ").split(delimiter)
        .forEach(function (s) {
            row = [];
            r.forEach(function (c, k) {               
                row.push( (k === colToSplit-1) ? s.trim() : c);
            })
            resArr.push(row);
        })
})
return resArr;}

Any help is highly appreciated.

4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.