Forum Discussion

MaeveO16's avatar
MaeveO16
Copper Contributor
Jul 03, 2023

Adding numerical cells based on names in another column.

Hello!! I am working on an Excel spreadsheet where people can copy and paste in their data, then there is a column that will add up time durations and display it for them. The issue is, is that there need to be multiple totals displayed since their data will have different shifts/teams. I have included a screenshot below of what the spreadsheet looks like. I added in sample data, but this would initally start out blank, then people would copy and paste their data into it.

I want that last column to add up the durations column but based on the shift/team in the Shifts/Teams column. 

 So basically, is there a way to make a formula that adds up the cells in one column based on the names in the cells of another?

 

2 Replies

  • Patrick2788's avatar
    Patrick2788
    Silver Contributor

    MaeveO16 

    If you're looking to do some selective accumulation, maybe SCAN:

     

    =SCAN(
        0,
        duration,
        LAMBDA(a, v,
            LET(r, XMATCH(UNIQUE(shift), shift) + 1, IF(XOR(ROW(v) = r), v, a + v))
        )
    )

     

Resources