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)
Related
My formula is
=IF(OR(ISBLANK(F2),ISBLANK(D2)),"MISSING",F2-D2)
D2 and F2 are both dates, F2 only has a date if something has been entered for that invoice so not all cells in column F have a date. So if the cell in column F is blank, I want the formula to put "MISSING" in the cell of the formula but I'm getting
#VALUE!
Where am I going wrong with this formula?
Your formula will attempt the subtraction even if the values in the cells are text.
If you want to calculate only when both cells have dates, then use IsNumber() instead of IsBlank(), but you need to change OR() to AND() and reverse the true/false actions.
=IF(AND(ISNUMBER(F6),ISNUMBER(D6)),F6-D6,"Missing")
I am trying to do a sumif formula that is based on a letter in column N. Right now my formula gives me a value error and I am trying to fix it. My current formula looks like this:
=IF($N$4:$N$51="S",SUMIF($E$4:$E$51,H91,$L$4:$L$51),"")
I am trying to say, if the letter in column n is S, then sumif this formula. My sumif formula is correct, just getting it to only add up the rows that have an s in column n is where it is wrong.
I want to add a formula in penthao report to get sum of distinct values in a column. The formula of penatho is similar to excel. So how do i do that in excel. Please help.
I'm not sure if this can be done in a single cell, but it certainly is possible by adding in an extra column. For instance, if your range is A1:A25, you can type this formula in Cell B1 and drag it down to cell B25:
=IF(COUNTIFS(OFFSET($A$1,0,0,ROW(),1),$A1)=1,1,0)
This formula enters a 1 if the value in the range is the first occurrence, and 0 otherwise. The last step is to use a simple sumproduct for the final result:
=SUMPRODUCT($A$1:$A$25,$B$1:$B$25)
I'm trying to create a formula in column K which sums all cells that apply , in column J, only when the following conditions are true:
dates are the same in column A
AND client name is the same in column B
For example, in cell K2, I want the sum of J2+J3+J4 because A2=A3=A4 and B2=B3=B4.
K5=J5 only, because there are no other dates with the same client name.
K6=J6+J7 because A6=A7 and B6=B7.
What kind of formula would I use for this? I can't figure out how to do it with a SUMIFS.
I would try using a pivot table with:
The names as row values
The dates as the column values
And funds received using SUM in the values column
Edit
Based on #pnuts comments here is how to get the values in column K. Put this in K2 and drag down.
=IF(OR(COUNTIFS($B$1:B3, B3) = 1, B3 = ""), SUMIFS($J$2:J2, $A$2:A2, A2, $B$2:B2, B2), "")
This formula will give blank values until the formula finds a new client on a new date. However, I still think using pivot table is a better solution.
However, I still find the pivot table
In cell K2 put following formula:
=IF(COUNTIFS($A$2:A2,A2,$B$2:B2,B2)=1,SUMIFS($J$2:$J$10,$A$2:$A$10,A2,$B$2:$B$10,B2),"")
Adjust row 10 value. It will be last row of your actual data.
Copy down as much you need.
EDIT
Uploaded file shows the cause behind formula not working correctly for you. It turned out to be whitespace characters in column B (names) data e.g.
Cell B3: "Moe John" has a trailing space.
Cell B10: Same case with "Doe Jane"
If you want to use above posted formula then all names shall be corrected. Or alternatively to deal with spaces you can adopt below approach.
=IF(COUNTIFS($A$2:A2,A2,$B$2:B2,"*"&TRIM(B2)&"*")=1,SUMIFS($J$2:$J$28,$A$2:$A$28,A2,$B$2:$B$28,B2),"")
Notice the change in COUNTIFS formula where B2 is now replaced with "*"&TRIM(B2)&"*".
Even such formula will take a beating if you have uneven whitespace characters in between your data. I'd suggest normalizing it as much as possible.
Further to my previous question, Im trying to get cell E20 (Total) to work similarly - sum all cells preceeding until the the formula itself (E20), again to avoid any cells being excluded as rows are added. So far i have:
=SUM(INDEX(E:E,ROW()+1):INDEX($E:$E,ROW() + IFERROR(MATCH(“TOTAL",INDEX(D:D,ROW()+1):$D1004001,0)-1,MATCH(“TOTAL”,INDEX(D:D,ROW()+1):$D1004001,0)-1)))
So far I am simply returning an error message.
I am trying to sum everything in column E until it reaches one cell above the word Total in column D, to avoid a circular reference. Any thoughts?
Screenshot of workbook
No volatile or array formulas needed:
In E2:
=IF(F2="",SUM(INDEX(F:F,ROW()+1):INDEX(F:F,MATCH(1E+99,F:F)))-SUM(INDEX(E:E,ROW()+1):INDEX(E:E,MATCH(1E+99,F:F))),"")
And copy down the Column. Then a simple sum formula at the bottom
E2:
=AGGREGATE(9,6,(OFFSET(F3,0,0,
AGGREGATE(15,6,ROW(F3:F999)/ISBLANK(F3:F999),1)-ROW(F3))))
Copy/Paste into E8 and E14. The formula for the Total is pretty simple:
E20:
=SUM(E$2:E19)
After entered as indicated, these formulas will auto-adjust when you insert or delete rows in between, because they use relative references.
There's probably better ways, but this will work. I In cell E2, =SUMIF(F1:F7,"<>""""",F1:F7) and similarly in cell E8, etc. The range intentionally includes blank lines above and below each block of data, to ensure that Excel will adjust for any lines that you insert or delete.
For E20 you can just use the same format, =SUMIF(E1:E19,"<>""""",E1:E19)