Google sheet - sumif with two conditions - google-sheets

apologies for the very basic question but I've created a home-made expenses tracker on Google Sheet just for fun and to improve my skills but I'm struggling to make this formula work.
In tab 1 I have a calendar that looks like this:
In tab 2 I have all my transactions:
My idea was to use sumifs in tab 1 so that for the earnings I can sum all transactions that were done in December 2022 and define that all amounts need to be greater than 0, similarly, for the expenses, all transactions would be less than 0.
I did try this formula which obviously doesn't work as I don't know how to specify whether transactions need to be greater or less than 0:
=SUMIFS(transactions!$D:$D,transactions!$A:$A,$B3,transactions!$D:$D,transactions!D3>0)
I'd really appreciate your help, thank you!

try:
=SUM(FILTER(transactions!D:D, transactions!A:A=B3, transactions!D:D>0))
or:
=BYROW(B3:B11, LAMBDA(x, SUM(
FILTER(transactions!D:D, transactions!A:A=x, transactions!D:D>0))))

Related

Need to count unique incident ID #s that fall within a date range - Google Sheets

Good Afternoon,
I have a table that looks like this:
IncidentDate
IncidentID
8/12/2021
154541
8/14/2021
154542
8/14/2021
154543
8/17/2021
154544
8/18/2021
154545
8/18/2021
154545
I'm trying to write a formula that would count the number of unique IncidentIDs within a certain date range and display that total in a third column. In this case I am breaking down by month, but I'll also need to be able to define more specific ranges by week and by day of the week, if possible.
My apologies if I am asking too much, I am fairly new to this field.
Any help is greatly appreciated.
there is COUNTUNIQUEIFS and it goes like:
=COUNTUNIQUEIFS(B1:B, A1:A, ">=8/14/2021", A1:A, "<8/18/2021")

Google tabs IMPORTRANGE with SUMIF problems

I know it has already been a few times discussed topic, but I haven't found any help that would suit my problem yet.
I'm trying to make a sum of numbers in one column in a different Google sheet. The problem is I need to sum only those numbers happened in chosen month. I have the number of the month in the sheet where I need the function, and I have the month specifikation in a column next to the numbers.
All I came to till now is this (after many totally different codes):
=sum(query(IMPORTRANGE("xyz";"Výkaz!B23:C125");"select Col2,Col3 where "col2=G4";0)"))
G4 is the chosen month I have in the same sheet as this code
Please, could you help me figure this out? Thank you
Google Sheet 1 (TabName = "externalTab")
Google Sheet 2 (TabName = "InternalTab")
Use importrange to pull the all data from "externalTab" to "Internal Tab". Then just use a sumifs formula to add up values based on your criteria.
=IMPORTRANGE("https://docs.google.com/spreadsheets/d/1sLPGZkAVlxWfjhDMU9oa_cww0AI570Rtem0XCoOx0AE", "'externalTab '!A1:AF2000")
Alternatively use the following formula. Integers to be summed are located in column a/Col1 and Months are located in column b/Col2. There is one header row on the spreadsheet and we are adding up all the Integers that correspond to the month June.
=sum(query(importrange("https://docs.google.com/spreadsheets/d/1sLPGZkAVlxWfjhDMU9oa_cww0AI570Rtem0XCoOx0AE","a1:b1000"),"select Col1, Col2 WHERE Col2 = 'June'",1))

Google Sheet countif only visible data using sumtotal

Sell / Buy
Buy
Buy
Sell
Hi all,
I have google sheet that has a lot of Data However, i want to count number of "Buy" and "Sell" based on filtering the dates NOT the whole column ONLY VISIBLE rows
The code i'm trying to use is the below
=SUMPRODUCT(SUBTOTAL(9,OFFSET(E4,ROW(E4:E100)-ROW(E4),,1)),--(E4:E100 = "Buy"))
i'm really having bad time solving this issue, i would greatly appreciate if someone can help me with the code.
thank you.
add column of SUBTOTAL
=SUBTOTAL(103, B4)
hide it:
then use:
=COUNTA(IFNA(FILTER(B4:B, C4:C="buy", D4:D=1)))
=COUNTIF(D4:D, 1)
="Buy: "& COUNTIFS(C4:C, "buy", D4:D, 1)&
" Sell: "&COUNTIFS(C4:C, "sell", D4:D, 1)

=SUMIF Google Spreadsheet Help needed

I am new to spreadsheets and I need some help.
I created a sheet to register money to be reimbursed.
What I want to do is:
a) The total shows the total amount in Column 'C' but it will subtract the row value only if/when Column 'E' says yes.
b) The total should be on display all time in the merged cells on 'F'.
I was using this:
=SUMIF(E2:E9; "Yes"; B2:B9)
But I think am Way off.
Any kind of help is welcome.
Spreadsheet for reference: Link here
Does this formula work as you want:
=SUMIF(E:E;"No";C:C)

Sum / Counting items in a column that match 3 criteria

Thank you ahead of time for anyone who can help me with this, I think I am close, but it still isn't working.
I have a simple sheet activity reporting sheet that I am asking staff to complete over the upcoming year - It has 5 columns:
Column A: Date -In format (4/4/2013 13:30:00)
Column B: Title -In format (text string)
Column C: Attendance -In format (Numbers)V
Column D: Vol led - In format (text string)
Column E: Staff Led - In format (text string)
Using this data I am 90 % positive that I can aggregate on a different summary sheet that contains some static data like months (in the B column) to aggregate on. I am having trouble configuring the criteria in the filters though to cause the correct output to either sum or count .
Quantity of events ed by either staff or vol, if neither box is checked the event should not be counted) Right now I am trying this but it is not working
=SUM(FILTER('Hostel Activities'!A:A,MONTH('Hostel Activities'!A:A)=$B3, NOT(AND(ISBLANK('Hostel Activities'!D:D),ISBLANK('Hostel Activities'!E:E)))
Total number of attendance in a month for activities led by staff or volunteers Right now I am trying this but it is not working
=SUM(FILTER('Hostel Activities'!A:A,MONTH('Hostel Activities'!A:A)=$B3, NOT(AND(ISBLANK('Hostel Activities'!D:D),ISBLANK('Hostel Activities'!E:E)))
THIE WORKS! ## Heading ##Total number of volunteer led activities in a month for activities Right now I am using this and it IS working
=COUNT(FILTER('Hostel Activities'!A:A,month('Hostel Activities'!A:A)=B3,not(isblank('Hostel Activities'!E:E))))
Thank you for any assistance and/or guidance
Danny
The first problem I see with your first two formulas is that you're calling SUM on your FILTER result. But the FILTER is returning the column A, which are dates. So, your basically summing dates, which will surely not yield the result you're looking for. Why are you not using COUNT, as you did on your last formula?
Second, the first two formulas you pasted are identical, how do you expect them to return different results?
It seems that for the first two want to sum an OR condition. You can do this two ways (that I can think of now). The simpler to understand is just to sum two COUNT(FILTER(... formulas, one for each criteria, e.g.
=COUNT(FILTER('Hostel Activities'!A:A,month('Hostel Activities'!A:A)=B3,not(isblank('Hostel Activities'!D:D)))) + B6
Assuming that on B6 is the other COUNT formula (the 3rd one, that already works).
Another option would be to use an OR function as criteria for the FILTER. Like this:
=COUNT(FILTER('Hostel Activities'!A:A,month('Hostel Activities'!A:A)=B3, OR(NOT(ISBLANK('Hostel Activities'!E:E)), NOT(ISBLANK('Hostel Activities1!D:D))) ))
I believe I have figured out a method that works by making some adjustments in the formulas and the source data.
Basically
IN THE SOURCE REPORTING DATA:
I combined columns D and E into the same column and added data validation so the coordinator has to enter if the activity is led by staff,volunteer, or neither.
IN THE MONTHLY AGGREGATION REPORT:
To count the number of activities led by either staff or volunteers I used this :
=COUNT(FILTER('Hostel Activities'!A:A,month('Hostel Activities'!A:A)=B3,'Hostel Activities'!D:D="Staff"))+E3
*E3 is the count of volunteer led activities which is found using this formula:
=COUNT(FILTER('Hostel Activities'!A:A,month('Hostel Activities'!A:A)=B3,'Hostel Activities'!D:D="Volunteer"))
Adding up the number of participants in activities run by either staff or volunteers was a little more difficult, but I was able to do it by adding up 2 unique equations. I would prefer using an OR statement in the filter criteria, but I just couldn't get that to work. This is how I was able to make it happen:
=SUM(FILTER('Hostel Activities'!C:C,month('Hostel Activities'!A:A)=B3,'Hostel Activities'!D:D="Staff")) + SUM(FILTER('Hostel Activities'!C:C,month('Hostel Activities'!A:A)=B3,'Hostel Activities'!D:D="Volunteer"))
Thank you all for your assistance

Resources