Forum Discussion

anirbangoa's avatar
anirbangoa
Copper Contributor
Dec 29, 2021
Solved

Formula for conditional sum for distinct values

I have 3 columns in a table - From, To, and Amount. From and To field contains names. The logic is if a name features in the From section, it would mean money is paid by that person and if the name features in the To field, it would mean money is received. I wish to calculate sum total of receipts/ payments for each distinct name. Is this possible through a formula?
I am attaching an excel sheet showing the input and the output that I wish to achieve.

 

 

5 Replies

  • NikolinoDE's avatar
    NikolinoDE
    Platinum Contributor

    anirbangoa 

    The most elegant approach would be with pivot, but you could also do it with a simple SUMIF function.
    Here is a link about Sumif.

    SUMIF function

    Tips: 

    • If you want, you can apply the criteria to one range and sum the corresponding values in a different range. For example, the formula =SUMIF(B2:B5, "John", C2:C5) sums only the values in the range C2:C5, where the corresponding cells in the range B2:B5 equal "John."

    • To sum cells based on multiple criteria, see SUMIFS function.

     

    Hope I was able to help you with this info.

     

    Nikolino

    I know I don't know anything (Socrates)

    • anirbangoa's avatar
      anirbangoa
      Copper Contributor
      Thanks for your reply.
      But John is hard-coded in the formula. Is there anyway where the name could be dynamic?

Resources