Sum cell numerical values based on text suffix

  • Heya,


    I used to have a similar formula for what I want to accomplish at my previous job, but I cannot for the life of me remember.


    I have a table with columns containing the following type of data


    | January |
    | 1RB |
    | 1RB |
    | 1RB |
    | 1RB |
    | 2RB |
    | 1RB |
    | 1RB |
    | 1PR |
    | 2PR |
    | 1FO |


    I'm looking for a formula that can sum the numerical values based on the two digit suffix. For the data above, the following results would be expect:


    | RB | 8 |
    | PR | 3 |
    | FO | 1 |


    I wish i knew how I did it previously but would really appreciate some help.


    Thanks,


    David

  • Hello,


    Probably you were doing with following :


    Code
    =SUMPRODUCT((RIGHT($A$2:$A$11,2)="RB")*VALUE((LEFT($A$2:$A$11,1))))


    Hope this will help

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • Code
    =SUMPRODUCT((RIGHT($A$2:$A$11,2)="RB")*VALUE((LEFT($A$2:$A$11,1))))


    Thanks Carim -- there were some extra brackets around the LEFT function, but seems to work like a charm.


    Cheers,



    David

  • Glad this could solve your problem ...:wink:


    Thanks ... for your Thanks ... AND for the Like ...:smile

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!