Mode formula not working - excel-formula

I'm struggling with MODE I have some surveys I am analysing.
Currently using =MODE(IF(AJ15:AJ24<>0,AJ15:AJ24))
One Question's answers are:
0
0
0
0
0
0
0
1
2
3
the formula is giving #VALUE error as there are no repeated numbers. Can anyone suggest how to get round this so it doesn't show an error.

=iferror(MODE(IF(AJ15:AJ24<>0,AJ15:AJ24)),"")
If your formula does not result in an error then the result of your formula is displayed. When your formula generates an error, "" or nothing is displayed.

Related

Count of consecutive repeated value only when repeated 3+ times

My goal is to count and potentially conditionally format the occurrences when a certain number of days pass with 0 sales.
I am trying to return the number of times 0 is repeated consecutively 3 or more times. So for this example I would like to see the return value of 3. So far I can't wrap my brain around how to do this, any ideas?
1
5
0
0
0
0
0
2
0
0
1
0
2
0
0
0
5
0
0
0
0
Thanks!
So #Barry Houdini's method applied to this problem would give
=SUM(--(FREQUENCY(IF(A1:A21=0,ROW(A1:1A21)),IF(A1:A21>0,ROW(A1:A21)))>=3))
entered as an array formula using CtrlShiftEnter
If you wanted to make it more dynamic and exclude blanks you could use
=SUM(--(FREQUENCY(IF(A1:A100<>"",IF(A1:A100=0,ROW(A1:A100))),IF(A1:A100>0,ROW(A1:A100)))>=3))
How about you make a help column with a simple sum formula with a "window" of three rows (or whatever you need). Then you conditionally format all values which are 0 in that column. That should provide you with the information you are looking for.

Counting digit in column based on subject

I am just using formulas in excel and was wondering how you could count all the 0s until a 1 is reached, and then start the process over again, based on subject number. If this is not possible simply with formulas, how could I write a VBA code for this?
Right now I am trying to use,
=IF(OR(F4=0,F3=1),"",COUNTIFS($A$2:A2, $A$2,$F$2:F2,0)-SUM($I$2:I2))
which I input in I3 and I change the COUNTIFS($A$#:A#, $A$#...) part for each subject number.
This seems to work with the exception of the last grouping, as it won't output a number before the next subject.
Example Data:
subid yes number_yes(output)
1 0
1 0
1 0 3
1 1
1 0 1
1 1
1 0
2 0
2 0 2
2 1
2 0
2 0
3
etc.
A blank cell is numerically zero and that is one of your accepted conditions. Differentiate between blanks and zero values.
=IF(and(f4<>"", OR(F4=0,F3=1)),"",COUNTIFS($A$2:A2, $A$2,$F$2:F2,0)-SUM($I$2:I2))
Based on #Jeeped answer. If you use -SUMIF($A$2:A2,A3,$I$2:I2) instead of -SUM($I$2:I2) you don't need to adjust this part for each subject number. Just use the following formula in I3 and copy it down.
=IF(AND(F4<>"",OR(F4=0,F3=1)),"",COUNTIFS($A$2:A3,A3,$F$2:F3,0)-SUMIF($A$2:A2,A3,$I$2:I2))
Note that I also changed the second parameter in the COUNTIFS to A3.

division to zero handling excel

So I have a table like this:
Element Rate
Apple 3
Apple 4
Banana 2
Banana 0
Ananas 0
Ananas 0
Kiwi (empty)
I want to find a average of the elements when it is above 0, when all 0 to get 0 and when cell is empty/blank to return n.a.
The core part of the formula I use is something like this :
AVERAGEIFS(Overview[Rate];Overview[Element]; D61;Overview[Rate]; ">0")
which gives me division to zero error, when all my values are 0 in the table such as if I want to find average for the Ananas, I thought this might work and the error I would get from in case of the empty cell I could just use IFERROR function to return "n.a.", but stucked, what is the reason for this and how can it be solved?
Well, as I said wrap your function in an iferror as shown:

How to treat two same value as 1 and add with other value in excel

I have datasets which contains same value, please find the below datasets,
`
A B
1122513454 0
1122513460 0
1600041729 0
2100002632 147905
2840007103 0
2840064133 138142
3190300079 138040
3190301011 138120
3680024411 0
4000000263 4000000263
4100002263 4100002268
4880004352 138159
4880015611 138159
4900007044 0
7084781116 142967
7124925306 0
7225002523 7225001325
23012600000 0
80880593057 0
98880000045 0
`
I have two columns ( A & B).Into the b column i have same value (138159,138159).It appears two times.
I just want to build a formula, where it will get a same value it will count as 1. That means, i am getting two 138159, but formula will treat as 1. and finally it will count the whole b column value.
That means,
0 is here 10 times and other value is also 10 times, but 138519 appears 2 times, so it will counted as 1, so other values are 9 times.
So my expected output will be 10+9=19
I have written following formula for that
=+COUNTIF(K20:K39,0)+9
I did manually. and it's driving me crazy.
can you guys help me for that.
any suggestion is really appreciable.
Try,
=SUMPRODUCT((B1:B20<>0)/COUNTIFS(B1:B20, B1:B20))

Version Difference in LINEST function

I'm trying to debug an issue I'm having with the LINEST function. It appears that I'm getting different results depending on version. Particularly Excel 2007 vs. later versions.
For....reasons... I am attempting to produce a quadratic regression that uses only a subset of the values. The trick is that subset can change dynamically based on user input.
Here's the data for the particular case where I identified the bug:
Y keep x x^2
1 1 .0001 .00000001
2 1 .0001 .00000001
3 1 .0024 .00000576
4 1 .0024 .00000576
5 1 .0037 .00000729
6 0 0 0
7 0 0 0
8 0 0 0
9 0 0 0
10 0 0 0
I am using the keep variable to produce the intercept. Here's the actual function I'm using to get the coefficients:
b2: LINEST(Table[y], Table[[keep]:[x^2]], FALSE, FALSE)
b1: INDEX(LINEST(Table[y], Table[[keep]:[x^2]], FALSE, FALSE),2)
b0: INDEX(LINEST(Table[y], Table[[keep]:[x^2]], FALSE, FALSE),3)
This seems to work correctly in later versions of excel and I get a value of 1588628.76 for b2. In Excel 2007, I'm getting a value of 0. Clearly that is a problem.
I have not been able to find any documented differences in the implementation of LINEST between versions. Is anyone aware of what the difference is and how I might be able to make this function robust to version differences?
After a bit more thought, I decided it best to just revert to the math to ensure a robust solution. Here's what I used:
b2: =INDEX(MMULT(MMULT(MINVERSE(MMULT(TRANSPOSE(Table[[keep]:[x^2]]),Table[[keep]:[x^2]])),TRANSPOSE(Table[[keep]:[x^2]])),Table[y]),3)
b1: =INDEX(MMULT(MMULT(MINVERSE(MMULT(TRANSPOSE(Table[[keep]:[x^2]]),Table[[keep]:[x^2]])),TRANSPOSE(Table[[keep]:[x^2]])),Table[y]),2)
b0: =INDEX(MMULT(MMULT(MINVERSE(MMULT(TRANSPOSE(Table[[keep]:[x^2]]),Table[[keep]:[x^2]])),TRANSPOSE(Table[[keep]:[x^2]])),Table[y]),1)

Resources