Sum row in Excel/Google Sheets based on Condition - excel

It seems like this question should exist somewhere, but I can't seem to find it...exactly.
The most similar solution I can find requires the use of SUMIFS or SUMIF, which only seems to add up numbers in a column, not spanning multiple columns. Here's an example sheet with 2 rows:
A B C D E F G H ...
1 2015-01-01 0 1 6 12 45 12 5 ...
2 2016-01-01 256 43 13 35 134 135 12 ...
Now I'd like to have a cell somewhere that adds all of the cells in the row for 2015-01-01. My attempt looks like:
SUMIF(A1:A30,"2015-01-01", B1:BJ30)
But this only yields the sum of the column B, so 0 for the exact formula above or 256 if I were to do this for the year 2016.
When trying something with SUMIFS, I'm told that the criterion range's size should match the sum range size, which isn't the case because my criterion range is only the first column of dates.
How can I add all the values in a row if the first cell's date matches my criterion? It may be worthwhile to note that this is in Google Sheets, not Excel.

In both excel and googlesheets you can use a SUMPRODUCT, for example:
=SUMPRODUCT((A1:A30 = DATE(2015, 1, 1)) * B1:BJ30)

You can try either of these:
=if(A1=date(2015,1,1),sum(B1:F1),"")
=if(A1=A1,sum(B1:F1),"")

Related

How to count conditional formatted cell colors across a row

I have 5 cells that are conditional formatted. Column B is CF for 48 months and turns red on 48 months and 1 day, Column C is for 36 months, Column D is for 24 months, Column E is for 18 months, and Column F is for 12 months.
I would like to be able to use a count color formula to count the green color cells across the row (i.e., B1:F1) and place the result in H1. I have tried to use every VBA I could find but none of them work. For Example, when I use a COUNTConditionColorCells Function, it produces different number sequences next to the cell range box (see attachment) Thanks
Sample Worksheet
Function Argument

Excel Index Match Sumifs

I have a table of data where column headers are account numbers, and I'm trying to sum all data for a specified account when one column (left hand column) equals a certain number.
724| 453 | 345
1 90 0 2
2 91 1 3
3 80 5 4
So would like a formula that would sum account 453, or 345 if values in first column are less than 2. I've written an index/match function to find the column for a specified fund. But can't seem to add in the sumif or sumifs to help sum. if there is a better way, please help.

Count the repeat of numbers from a number in a same cell in excel

I got a bit confusing situation with excel, I would like to give an example
the spreadsheet is with a number unique to the cell and column
colA colB colC
101 102 103
201 202 203
Now, I have to find the repeats like below from above range
0 = 6 times
1 = 5 times
2 = 4 times
3 = 2 times
I have tried with CountIf() family functions, tried various functions from Len() etc.
If somebody can help in it, please.
To count the 0s:
=SUMPRODUCT(LEN($A$1:$C$2)-LEN(SUBSTITUTE($A$1:$C$2,0,"")))
adjust the ranges as needed, and change 0 to 1, 2 etc, or use cell references.
In D1 enter:
=LEN(TEXTJOIN("",TRUE,A:C))-LEN(SUBSTITUTE(TEXTJOIN("",TRUE,A:C),ROW()-1,""))
and copy downward:

Sum columns in Excel

I want to sum the columns B-D given that column A equals "far".
Does anyone have a smooth formula for this calculation?
The answer should read : 10+10+3+12+2+5 = 42
A B C D
Far 10 10 3
Sol 10 21 12
Far 12 2 5
Sol 10 2 62
Gulf 10 4 0
SUMPRODUCT:
=SUMPRODUCT(($A$2:$A$6="Far")*$B$2:$D$6)
SUMIF:
=SUMIF(A:A,"Far",B:B)+SUMIF(A:A,"Far",C:C)+SUMIF(A:A,"Far",D:D)
Both have their advantages and disadvantages.
SUMPRODUCT is shorter formula and easier to maintain but it is an array type formula and the references need to be limited to the data set.
SUMIF is not array but it requires the ranges to be the same size and as such one must do a SUMIF for each column and then sum the results.

Sum the values of if statements on multiple rows? (Excel)

Say I have a spreadsheet which looks like this:
A B C
1 In Actual Predicted
2 Thing One 300
3 Thing Two 564
4 Thing Three 256 1065
I want to be able to get a sum of the "predicted" column which incorporates values from the "actual" column if the "predicted" value is empty.
I.e. in this case, the value would be 300 + 564 + 1065 = 1929.
I know that I can achieve this for any individual row like so:
IF(C2="",B2,C2)
How do I get a sum of these "if" statements for each individual row?
Thanks.
That can be done with Sumifs() and no helper columns
=SUMIFS(B:B,C:C,"")+SUM(C:C)
Cell D2 = IF(C2="",B2,C2)
Cell D3 = IF(C3="",B3,C3)
...drag / copy to all relevant D cells...
Cell E1 = Sum(D:D)

Resources