SumProduct over Range that includes text - excel

I'm trying to use a sumproduct formula over a range (e.g., A2:B10) given that the corresponding cell in column C = "Mike" - I keep getting #value errors thrown at me because there is text in some cells in the A2:B10 range.
I'm looking for the sum of the numbers(assuming it's a number) in each row with "Mike" in column C.
Formulas I've tried:
=SUMPRODUCT(--(C2:C10="Mike"),A1:B10)
=SUMPRODUCT((C2:C10="Mike")*(A1:B10))
=SUMPRODUCT(A1:B10,C2:C10="Mike")
Any help is appreciated, Thanks!

Try this formula with SUMPRODUCT
=SUMPRODUCT(A2:B10,(C2:C10="Mike")*ISNUMBER(A2:B10))
or you can use an "array formula"
=SUM(IF(C2:C10="Mike",A2:B10))
that latter formula needs to be confirmed with CTRL+SHIFT+ENTER so that curly braces appear around the formula in the formula bar

Related

COUNTIFS with Numeral comparison

Not sure what mistake I doing with CountIFS.
Cells A1:A8 refer to cells in another sheet and B1 has the formula
=COUNTIFS(A1:A8,">2020")
it gives 0
But same values are hard typed in C1:C8 and D2 that references C1:C8 gives the right answer
Thanks
Here is a formula that will work for either Text or Numbers in column A:
=SUMPRODUCT((--(--A1:A8>2020)))

Is there a way to get the ISTEXT formula to ignore if there is a formula is the reference cell?

I have a simple formula:
=IF(ISTEXT(A3),"EA"," ")
I just need the cell with this formula to return EA is there is text in A3. The problem is the column A is feeding off of another sheet so each cell has a formula in it. My ISTEXT formula keeps returning EA even though the cell itself is blank. I'm guessing this is due to the cell having a formula in it. Any ideas how to make the ISTEXT ignore formulas?
I'd just check the length of the cell:
=IF(LEN(A3)>0,"EA","")

Excel - Does a range of cells contain a value in a list?

I want to answer - does a range of cells (A1:E1) contain any value from a list (G1:G50)
In other words: Does A1 OR B1 OR C1 OR D1 OR E1 contain any value that appears in G1:G50
This formula might give you the result you want:
=SUM(IFERROR(MATCH(A1:E1,G1:G50,0),0))>0
You have to make it an array formula. That means after typing or pasting this formula into you target cell you have to commit it not as usual with simple 'Return' but by 'Ctrl+Shift+Return'. If you did it right the formula will be surrounded by curled brackets in formula bar.
You can use COUNTIF within SUMPRODUCT like this
=SUMPRODUCT(0+(COUNTIF(A1:E1,G1:G50)>0))>0
That doesn't need "array entry"

Need formula using SUMPRODUCT that bypasses #VALUE! entries

I have the following formula:
=SUMPRODUCT(--((('Sheet1'!$L$2:$L$100000<=X8)*'Sheet1'!$L$2:$L$100000)>=W8))
Column L is an output of dates. X8 and W8 are dates that collectively form a range.
This formula works great if all dates are returned or if there are some blank cells in column L. But if instead any cell in column L has code that returns #VALUE!, then the formula breaks down.
So basically, I need to modify this formula to accommodate for the fact that some cells in column L return #VALUE!. Is there a way to overlook such cells so that the formula only handles cells that have returned actual dates?
As I follow up from comments, this formula works:
=COUNTIFS('Sheet1'!$L$2:$L$100000,"<="&X8,'Sheet1'!$L$2:$L$100000,">="&W8)

How to count blanks in a row, after first Non Blank cell of that Row

For instance i have a range "B3:AY3" and first non blank cell that contains value is "R3", i need to count all blank cells after cell "R3"
This formula must be array-entered:
A3: =COUNTBLANK(OFFSET(MyRange,0,MATCH(
TRUE,LEN(MyRange)>0,0)-1,1,COLUMNS(
MyRange)-MATCH(TRUE,LEN(MyRange)>0,0)+1))
where MyRange = B3:AY3
and fill down as needed
To array-enter a formula, after entering
the formula into the cell or formula bar, hold down
ctrl-shift while hitting enter. If you did this
correctly, Excel will place braces {...} around the formula.
The above formula will return an error message if there are ONLY blank cells in the range, or if there are any cells in the range which contain an error. If that is a problem, use the following array-entered formula instead:
=IFERROR(COUNTBLANK(OFFSET(MyRange,0,MATCH(
TRUE,IFERROR(LEN(MyRange)>0,TRUE),0)-1,1,COLUMNS(
MyRange)-MATCH(TRUE,IFERROR(LEN(MyRange)>0,TRUE),0)+1)),COLUMNS(MyRange))
IT will count errors as being non-blanks, and count all the cells if all are blank.
and first non blank cell that contains value is "R3"
I have taken the example for Row 1. Amend as applicable :)
Try This
=COUNTBLANK(INDIRECT(ADDRESS(1,MATCH(TRUE,LEN(A1:AY1)=0,0)) & ":AY1"))
Enter this as an Array Formula. i.e you have to press Ctrl + Shift + Enter instead of Enter
For 3rd row, the formula becomes
=COUNTBLANK(INDIRECT(ADDRESS(3,MATCH(TRUE,LEN(A3:AY3)=0,0)) & ":AY3"))
If you only need it to work for row three then use the following:
=COUNTBLANK(B3:AY3) - (MATCH(TRUE,INDEX((B3:AY3<>0),0),0)-1)
This is a regular formula and will not need to be entered as an array, also as I am not using any Volatile function (like INDIRECT and OFFSET) in should also be much better performance wise.
All I m doing is counting all blanks, then subtracting all the blanks before the first cell with a value.

Resources