situation
A spreadsheet to maintain accounts.
A form as so: The form
What I want to do
I want to add the value in the column D if it has Type of transaction = Credit and If it has type of transaction = debit then I want to subtract it from the total. I am finding this total inside the spreadsheet itself. So I think SUMIF(...,...,...)
will be used but I am not sure.
Spreadsheet for reference.
I guess:
The criteria could be what is the first letter of the cell in column C which is in the same row as the cell now being considered which belongs to column D. If it is of the form C*
then it is credit if it is of the form D*
then it is a debit transaction. But I am unable to find out how to apply this condition.
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.
Google Sheets SUMIF to sum a data range on a condition SUMIF is a Google Sheets function to return a total of cells that match a single specific criterion. Put simply, the SUMIF function filters the range according to the specified criteria and sums values based on this filter. The syntax is the same as SUMIF Excel.
Using the IF Function The IF function can be used on its own in a single logical test, or you can nest multiple IF statements into a single formula for more complex tests. To start, open your Google Sheets spreadsheet and then type =IF(test, value_if_true, value_if_false) into a cell.
The SUMIF criteria in Spreadsheet works as follows:
=SUMIF(range, criteria, sum_range)
whereby range is the range from which you want to match (C column in your example, which has Debit/Credit)
Criteria = what should match (Debit or Credit based on the formula in your example)
Sum_range = The Column that needs to be summed - (D column in your example)
So your formula should be somewhat
=SUMIF(C1:C1000,"D"&"*",D1:D1000) for Debit
=SUMIF(C1:C1000,"C"&"*",D1:D1000) for Credit
Note: you can use "Debit" or "Credit" in place of "D"&"" or "C"&"" respectively.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With