I know is a pretty basic question, but surprisingly, I can't seem to find a solution for it.
I'm looking to averageif every 10th cell that doesn't contain a 0 value, but for some reason the syntax doesn't work. I can't just take a range from between the first and last cell because there are other values in between that I don't want to be part of the average. I would have expected something like the below to work just fine, but it keeps returning an error message.
=AVERAGEIF(C4+C14+C24+C34+C44+C44,"<>0")
Any ideas? Thanks a bunch.
I've figured out a solution to my question (in case anyone comes across this in the future).
Instead of using AVERAGEIF, you can use a combination of the SUM and FREQUENCY functions.
To find the average of these cells [C4+C14+C24+C34+C44+C44] but exclude all 0 values, it looks like this:
=SUM(C4+C14+C24+C34+C44+54)/INDEX(FREQUENCY((C4+C14+C24+C34+C44+C54),0),2)
Credit to this blog for the help: http://colinlegg.wordpress.com/2013/05/04/conditional-average-on-non-contiguous-ranges-using-frequency/
I would use a "helper column"
In B1 enter:
=INDIRECT("C" & 4+10*(ROW()-1))
copy B1 to B2 thru B6
Then use:
=AVERAGEIF(B1:B6,"<>0")
Related
I would really appreciate some help whit my problem. I tried to read about it but nothing I found works.
I am trying to pull some data from another spreadsheet based on multiple criteria /entered in cells B4:B6/.
B4 - Customer Name
B5 - FROM Date
B6 - TO Date
I want to be able to extract data based on only one cell or any combination of them.
/B4&B5,B4&B6,B5&B6,B4&B5&B6/
I tried using the following formula:
COUNTIFS(JOBS!$C$1:$C$10000,$B$4,JOBS!$L$1:$L$10000,">="&$B$5,JOBS!$L$1:$L$10000,"<="&$B$6)
The formula works fine if all cells /B4:B6/ are filled but returns #NUM! if one is empty.
I tried:
COUNTIF(JOBS!$C$1:$C$10000,$B$4)+COUNTIF(JOBS!$L$1:$L$10000,">="&$B$5)+COUNTIF(JOBS!$L$1:$L$10000,"<="&$B$6)
The formula works fine if only one cell /B4:B6/ is filled but the data overlaps if 2 or more are filed.
Use wildcards when empty:
=COUNTIFS(JOBS!$C$1:$C$10000,IF($B$4="","*",$B$4),JOBS!$L$1:$L$10000,">="&IF($B$5="",0,$B$5),JOBS!$L$1:$L$10000,"<="&IF($B$6="",99999,$B$6))
In fact the formula I am using looks very weird. The positions of criteria and range appeared to be switched.
The original formula looks like this:
COUNTIFS($B$4,JOBS!$C$1:$C$10000,$B$5,<="&JOBS!$L$1:$L$10000,$B$6,">="&JOBS!$L$1:$L$10000)
And it is working fine, apart from the problem I mentioned in the title.
Thanks to the idea Scott gave me I have rewritten my formula and now it looks like this:
COUNTIFS($B$4,IF($B$4="","",JOBS!$C$1:$C$10000),$B$5,IF($B$5="","","<="&JOBS!$L$1:$L$10000),$B$6,IF($B$6="","",">="&JOBS!$L$1:$L$10000))
Although, I am not sure if this is the right way the formula should be written, it works great and my problem is now solved.
I have a list of surfaces with a certain type, and I need the total of each type. I tried with VLOOKUP function but it only gives me the first result. I tried with this answer on another question, but it's too complex to get it working for me.
in cell H4 I have this function:
=VLOOKUP(G4;$D$2:$E$11;2;FALSE)
Thanks for your time.
You need SUMIF formula and not VLOOKUP like below.
=SUMIF($D$2:$D$11;G4;$E$2:$E$11)
Copy down.
I am trying to build a rank formula that ignores errors.
I've tried:
=Rank(BN4,(if(iserror(BQ4:BQ31),"",BQ4:BQ31)))
I've also Tried:
=IF(ISERROR($BQ$4:$BQ$31),"",1+SUMPRODUCT($BP$4:$BP$31=BP4,$BQ$4:$BQ$31>BQ4))
Is There something wrong with the formula? Is there a better way? See image below, the rank formula appears in Col BN. Thanks!
]1
Given the spreadsheet below:
You can use the following formula on C2 and drag it:
=IF(ISERR(A2),"",COUNTIF($A$2:$A$7,">"&A2)+1)
I think this is what's going on: in your second formula, your Sumproduct is still calculated with the errors. Although the first part your formula tells Excel to return a Blank when calculating the rank of an ERROR, the errors are stil inputted into second part where you actually calculate the rank, and thus Excel will spit out an Error even if it's calculating the rank of a regular number
The formula provided by Lucas above is probably the simplest way. If you must use sumproduct, you should include something in your sumproduct that tells excel to use a blank value if it comes across an error when calculating the some product.
For example, if you're trying to do the sumproduct of A1:A4 and B1:4 but the both ranges have some errors, then you'd use:
=SUMPRODUCT(IF(ISNA(A1:A4),0,A1:A4),IF(ISNA(B1:B4),0,B1:B4))
I'm pretty new with excel, but I have created a formula to calculate something from data I get from a sensor.
=100*((SUMPRODUCT(C16:C98,A16:A98)-SUMPRODUCT(C16:C98,A15:A97)+SUMPRODUCT(C15:C97,A16:A98)-SUMPRODUCT(C15:C97,A15:A97))/53.2)/((SUM(A16:A98)-SUM(A15:A97)))
as you can see it's quite long, and the values differ from time to time (sometimes it starts on c16 sometimes on c35,...)
I've tried adding an indirect link in the formula as the following:
original: SUMPRODUCT(C16:C98,A16:A98)
added indirect link: (SUMPRODUCT(INDIRECT(M25&":"&M26&","&M27&":"&M28)))
but this gives me a #REF! error.
Does anyone have an idea? Cheers.
B.
Edit: the M25 - M28 are the cells where I'll be putting my starting and ending cell number in. so in this case it would be "C16" in M25, "C98" in M26, "A16" in M27, "A98" in M28
You need to use INDIRECT for each array, try this:
=SUMPRODUCT(INDIRECT(M25&":"&M26),INDIRECT(M27&":"&M28))
I'm trying to tell Excel to change the cell reference for a SUMIF formula based on the last cell that contains a value in each row. Right now, I know I could write a nested if statement to do this for me, but it's far too unwieldy to be a long-term solution.
Example:
On a separate report, every person in this list has multiple lines recording their daily sales. On a small scale, I'd simply write a SUMIF that uses for A2, B3 and C4 as criteria. The scale is much much larger, so my current solution is to write out a logic check with the SUMIF formula folded into it.
In this case, the formula in E2 would be:
=IF(C2="",if(B2="",SUMIF('range',A2,'range'),sumif('range',B2,'range')),sumif('range',C2,'range'))
Is there a different way to tell Excel to run the SUMIF with the last value found in each row?
I was hoping I could use COUNTA for each row, then have the SUMIF formula use the COUNTA value to change the criterion cell reference. I'm missing something here.
=SUMIF('range',INDEX(A2:C2,MATCH("zzzzz",A2:C2)),'range')
seems worth a try.
Edit Too long for a comment:
I don’t really have any idea how =MATCH() works but think of it as traversing left to right while searching. When it fails to find a match it just happens to have been looking at the last entry and (conveniently!) offers that up. So the key is to look for something that won't be found.
For people’s names I chose “zzzzz” as unlikely to be present. For numbers anything up to 9.99999999999999E+307 is theoretically possible and hence some people use that (eg an hour ago Formula to get the first cell with a numerical value from a selection?) but I prefer a googol (1E+100) and that seems quite large enough, is much shorter – and easier to remember, even if a few 9s more or less would make no difference, nor likely what couple of integers are after the +.