Sum of 3 numbers in same cell using a reference formula as well

前端 未结 2 1080
我寻月下人不归
我寻月下人不归 2020-12-22 02:29

IN B1 I have: 3,4,5 IN B2 I have the sum of these numbers 12

I would like to add these together and the sum to appear in B3

So, for B3, I need to tell excel

相关标签:
2条回答
  • 2020-12-22 02:40

    Assuming you always have three numbers separated by a coma.

    =LEFT(B1,FIND(",",B1)-1) + MID(B1,FIND(",",B1)+1,FIND(",",B1,FIND(",",B1)+1)-FIND(",",B1)-1) + MID(B1,FIND(",",B1,FIND(",",B1,FIND(",",B1)+1))+1,100)
    

    If I break down the formula it's a bit simpler to see what is going on.

    1st number:

    LEFT(B1,FIND(",",B1)-1)
    

    2nd number:

    MID(B1,FIND(",",B1)+1,FIND(",",B1,FIND(",",B1)+1)-FIND(",",B1)-1)
    

    3rd number:

    MID(B1,FIND(",",B1,FIND(",",B1,FIND(",",B1)+1))+1,100)
    
    0 讨论(0)
  • 2020-12-22 03:01

    Alternate solution (if exactly three numbers separated by a comma):

    =SUMPRODUCT(--MID(SUBSTITUTE(B1,",",REPT(" ",99)),99*(ROW($1:$3)-1)+1,99))
    

    Or, to make the formula more dynamic so that the B1 cell can have any quantity of numbers, as long as they are separated by a comma:

    =SUMPRODUCT(--MID(SUBSTITUTE(B1,",",REPT(" ",99)),99*(ROW(INDIRECT("1:"&LEN(B1)-LEN(SUBSTITUTE(B1,",",""))+1))-1)+1,99))
    
    0 讨论(0)
提交回复
热议问题