Sum the Column A Only if Column B contains? - if-statement

I have the table in google-sheets which looks:
I need to sum sums according to the Card = "HDFC"
i.e need to display in cell 1408.8
Need help here.
I Tried:
=COUNTIF(C3:C1000,"HDFC")
but its give count only not sure how to use to get sumif on column B if matches column C

Simple SUMIFS() must work. Try-
=SUMIFS(B4:B,C4:C,E4)

or these:
=SUM(FILTER(B:B; C:C="HDFC"))
=INDEX(QUERY(B:C; "select sum(B) where C = 'HDFC'"); 2)

Related

Filter Data in Googlesheets

I have to face some problem about my Googlesheets Data. I want to filter my googlesheets data between two dates and also filter more conditions at the same time in same sheets. Below are given some sample data.
https://docs.google.com/spreadsheets/d/1h5PW52PoMUxXtrqEmfXSCWu_OKXVO8IwUbHqcqSPRzs/edit?usp=share_link
Basically, I want to filter data between two date & two more conditions at a same time in same sheets.
Please help me about this issues.
Thanks
I am trying to hard to solve this issues but I cann't solve this with myself. so if anyone solve this issues then please do this.
I'm very glad for all of you.
Thanks
use:
=IFERROR(QUERY('Raw Data'!A2:I,
"where 1=1 "&
IF(A7="",, " and B >= date '"&TEXT(A7, "e-m-d")&"'")&
IF(B7="",, " and B <= date '"&TEXT(B7, "e-m-d")&"'")&
IF(A10="",," and C contains '"&A10&"'")&
IF(A13="",," and D contains '"&A13&"'"), ), "no data found")
You can try:
=query('Raw Data'!A2:I,"Select * Where B >= date '"&text(A7,"YYYY-MM-DD")&"' AND B<= date '"&text(B7,"YYYY-MM-DD")&"'
AND C contains '"&A10&"' AND D contains '"&A13&"'")
Or, if you want to leave the dates empty:
=query('Raw Data'!A2:I,"Select * Where C contains '"&A10&"' AND D contains '"&A13&"'"&if(A7="",""," AND B >= date
'"&text(A7,"YYYY-MM-DD")&"'"&if(B7="",""," AND B<= date
'"&text(B7,"YYYY-MM-DD")&"'")))

Arrayformula to lookup last entry

I have this example here
I need to have the data in column D filled in with arrayformula. The value should be the value in column B.
I've tried using combination of ROW&INDIRECT&FILTER&QUERY|VLOOKUP , but it didn't work, as if ROW() cannot be used in arrayformula. Maybe you guys have some idea that could work.
use:
=ARRAYFORMULA(IF(C7:C="",, VLOOKUP(ROW(A7:A), IF(B7:B<>"", {ROW(A7:A), B7:B}), 2, 1)))

Adding a range of cells to one cell based on a condition

I have a sheet in Ms Excel with Loan details, where the loan status is either 'Paid' or 'Unpaid'. For every row, I want to add the amount value to cell C18 if the corresponding cell in status column reads "Unpaid".
eg. for row 10,
=IF(J10 ="Unpaid", $C$18+G10, $C$18+0) **{This does not work}**
How can I achieve this so as to use the formula for a couple of rows?
You might try ...
=C$18+(J10="Unpaid")*G10
This formula will add C18 to G10, but only if J10 says "Unpaid", otherwise, it will just add C18 to 0.
It can be "dragged down" for the other rows, and the '$' on C$18 will keep that cell fixed while the references for J and G will correspond to the row that the formula is in.
My guess from what you're saying is that you want to add column G only when the corresponding value in column J = "Unpaid".
If so, the formula you put in C18 is =SUMIFS(G:G,J:J,"Unpaid") or =SUMIFS(G10:G,J10:J,"Unpaid") if you want to start the sum at row 10.
You can't add to $c$10, only to a new column, lets say called 'balance'. There (column k) would be the formula =$k9+if($j10="Unpaid",$g10,0)
in Google Sheets:
=ARRAYFORMULA(IF(J10:J50="Unpaid"; C18+G10:G50; C18))

Change cell background color based on text in another column

What would the syntax be to conditionally format - if any cell in Column A contains a value that matches any value in Column B then display a blue background?
Looks like this would be done using Conditional Formatting under Format, where this custom formula works.
=OR(A1:A1000="Text Sample 1",A1:A1000="Text Sample 2")
Instead of listing a bunch of values in this formula, is there syntax that can represent values listed in another column (Column B)?
use this custom formula:
=REGEXMATCH(A1, TEXTJOIN("|", 1, B$1:B))
for exact finds use:
=REGEXMATCH(A1, "^"&TEXTJOIN("$|^", 1, B$1:B)&"$")
Custom Formula:
=QUERY(B:B," Select count(B) where B is not null and '"&A1&"' contains B label count(B) ''",0)
Apply to:
A1:A
Queries Column B for every cell in A starting from A1 and outputs count of cells.

How to populate a value when comparing two columns, VLOOKUP or IF?

I'm trying to create "Sale Rep" summaries by "Shop", where I can simply filter a column by the rep's name, them populate a total sales for each shop next to the relevant filter result.
I'm using this to filter all the Stores by Scott:
=(filter(D25:D47,A25:A47 = "Scott"))
Next, want to associate the Store/Account in F to populate with the corresponding value of E inside of G. So, G25 should populate the value of E25 ($724), G26 with E26 ($822), and F27 with E38 ($511.50)
I don't know how to write the formula correctly, but something like this is what I'm trying to do: =IF(F25=D25:D38),E25 I know that's not right, and it won't work in a fill down. But I'm basically trying to look for and copy over the correct value match of D and E inside of G. So, Misty Mountain Medicince in F27 will be matched to the value of E38 and populated in G27.
The filter is what's throwing me off, because it's not a simple fill down. And I don't know how to match filtered results from one column to a matched value in another.
Hope the screenshot helps. Screenshot of table:
Change Field Rep: Scott to Scott and you might apply:
=query(A25:E38,"select D,E where A='"&F24&"'")
// Enter the following into G25 and copy down column G
=(filter(E25:E47, D25:D47 = F25))
or
// Enter the following into G25 will expand with content in F upto row 47
=ArrayFormula(IF(F25:F47 <> 0, VLOOKUP(F25:F47, D25:E47, 2, FALSE),))