Forum Discussion

sandi saputra's avatar
sandi saputra
Copper Contributor
Mar 28, 2018

Need to Sum from cell which the value comes from formula

Hi Guys!

I need help to sum my table. In case, I need to sum range which contains formulas (If) such as:

in Cell A1 100; A2 200

Then in B1 I put formula,=IF(A1=100;"1";"2")

B2 =IF(A1=100;"1";"2")

so the value out is 1 and 2, then I need to sum this value, I have a thousand ranges.

 

I attach here, the range is colored yellow, please help me, really need to fix this problem :(

 

  • SergeiBaklan's avatar
    SergeiBaklan
    Apr 02, 2018

    Hi Sandi,

     

    In your yellow zone which you try to sum you have text only which is generated by formulas like

    =IF(RIGHT([@Tarif],1)="T","1","")

    SUM() ignores any text and returns zero since you have no one number in the range. You may update your formulas to return numbers instead of text, like

    =IF(RIGHT([@Tarif],1)="T",1,"")

    or to sum all cells which have text string "1" use

    =SUMPRODUCT(--([MPB]="1"))

    Please see attached

     

     

     

     

  • Hi Sandi,

     

    Do you really need text value as result of your formula? SUM ignores text, to sum you shall convert it back to numbers somehow. Easier to generate numbers from very beginning, like

    =(A1=100)+1

    in B1. With IF

    =IF(A1=100;1;2)

     

    • sandi saputra's avatar
      sandi saputra
      Copper Contributor
      Hi Sergei,

      Thank you for your response, I just came back to office. In case, in cell A1 is validated number, so if it doesn't mind you, would you like to open my file and see the cells which I need to sum.

      Thank you so much, very need help :)
      • SergeiBaklan's avatar
        SergeiBaklan
        MVP

        Hi Sandi,

         

        In your yellow zone which you try to sum you have text only which is generated by formulas like

        =IF(RIGHT([@Tarif],1)="T","1","")

        SUM() ignores any text and returns zero since you have no one number in the range. You may update your formulas to return numbers instead of text, like

        =IF(RIGHT([@Tarif],1)="T",1,"")

        or to sum all cells which have text string "1" use

        =SUMPRODUCT(--([MPB]="1"))

        Please see attached

         

         

         

         

Resources