Excel formula using countif - excel-formula

There are 11 numbers in a column.
5
5
5
5
12
13
5
9
2
5
10
I need to build a formula that tells me how many times occurs the following situation: Number is bigger than each of previous four numbers.
In this case the situation occurs 3 times. By:
12 bigger than 5;5;5;5
13 bigger than 12;5;5;5
10 bigger than 5;2;9;5

Assuming your data starts in A1 you can use if() and max() to do this. Add this to B5 (next to the 12 in your example):
=IF(MAX(A1:A4)<A5, 1, "")
This will put a 1 next to 12. You can copy this formula down to find the other values where this is true.
This works by looking at the MAX() value of the previous 4 values. IF() they are higher than the current value, then it prints a 1.

Related

How to get max value in the column whilst counting and then reset count after reaching 0 and start to count until other max value is reached

I am trying to get the max value per run from my table. Each run lasts a different amount of days hence there will be a different max value for each run. My current table column Days looks like this:
Days:
1
2
3
4
5
6
7
8
0
1
2
3
4
5
0
1
2
3
4
5
6
7
8
9
10
11
0
1
2
3
I have another column called Max Day, where I want to get the max day per run from the above Days column, this is the output that I want to get at the end:
Max Days:
8
5
11
3
I have tried doing:
=COUNTIF(A$1:A1, A1) but that doesn't do anything, it just returns 0. Is there a way I can get the max value and then when it reaches 0, it starts counting again and retrieves the max value for that count and then repeat.
If you have Office 365, this is a piece of cake with the new Filter() function. In the screenshot, the formula has been entered into cell C2 and has NOT been copied down. It does that automatically.
=FILTER(A2:A31,A3:A32=0)
Edit - Explanation. For a general understanding of the new Excel Dynamic Array functions, please refer to this blog by the Excel team.
The Filter function returns all rows that match a given criterion. In this case the range to be filtered and the range in the criterion are offset by one row. The filter looks at rows 2 to 31, but the comparison looks at rows 3 to 32.
The effect is that the filter returns a value when the comparison is TRUE for the NEXT row, not the current row. Hence, the function returns all rows where the row FOLLOWING the current cell contains a zero.

How to create two columns that match all values from a third in excel or OpenOffice?

I have one column with 10 cells, every cell have a different value in it. How can I create two columns that have every cell matching with the other 9.
Example :
1
2
3
4
5
6
7
8
9
10
Become
1 2
1 3
1 4
1 5
......
2 1
2 3
2 4
2 5
.....
10 1
10 2
10 3
10 4
10 5
10 6
10 7
10 8
10 9
I am not sure I read the same question as others did. I think your example was merely that, an example, and that these first 10 cells could contain anything and you wanted every permutation that could result. While I think that the other answers might work for the specific situation you describe, they may not work if you had other data in those cells. Hence I am offering a variation which uses a similar technique to reference the cells indirectly. The permutations of 2 objects from a set of 10 unique objects would result in 90 objects (which is why the above technique from Tom Sharpe references 90).
Assuming that you have your 10 items in A1 through A10, I would put the following formula in B1 and copy it down through B90:
=INDIRECT("R"&QUOTIENT(ROW()-1,9)+1&"C1",FALSE)
Also, I would use this formula in C1 and copy it down through C90:
=INDIRECT("R"&MOD(ROW()-1,9)+1+((MOD(ROW()-1,9)+1)>=QUOTIENT(ROW()-1,9)+1)&"C1",FALSE)
The result should give you something like what is shown in the attached matching your example.
Likewise, it would show the permutations of any values you had in A1 through A10 as shown in the second attached picture with words instead of the numbers 1 through 10.
In Excel (without VBA or such like), one way:
In A1 and copied down to A100: =INT((ROW()+9)/10).
In B1 and copied down with Ctr to B10: 1.
Select B1:B10 and copy down with Ctrl to B100.
In C1 and copied down to C100: =A1=B1.
Select ColumnsA:B, Copy, Paste Special, Values.
Filter A:C ,select TRUE in ColumnC and delete all blue indexed (visible content) rows.
Delete ColumnC.
Or in A1:
=QUOTIENT(ROW()-1,9)+1
copied down to A90 just to be different.
Then in B1:
=MOD(ROW()-1,9)+1+((MOD(ROW()-1,9)+1)>=A1)
copied down to B90.

Count the number of duplicates between rows excel

I’m wondering if someone can tell me how to count the number of duplicates that occur between 2 rows in excel? I’ve read lots of posts about counting duplicates in general, but it’s not quite what I’m looking for.
In the below example, I want to indicate how many numbers are repeated from the previous row. For example, Row 1 has 3 numbers repeating from Row 2. Row 2 has 1 number repeating from Row 3. Row 3 has 2 numbers repeating from Row 4. I don’t need to know what numbers or how many times each number was repeated, I just need to know how many occurrences of duplicates there are. Each number would be in its own cell. Is this even possible?
Row 1> 20 22 40 41 42 47
Row 2> 3 37 40 41 47 49
Row 3> 1 2 3 4 5 6
Row 4> 2 5 17 20 25 30
Use COUNTIF() wrapped in a SUM() as an array formula:
=SUM(COUNTIF(A2:F2,A1:F1))
Being an array formula it needs to be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode. If done correctly Excel will put {} around the formula.
Put the formula in the first desired output cell, Hit Ctrl-Shift-Enter. Then copy down.

Excel Hlookup function returning the first character in table

I am using Hlookup to find in a row where the value is "A", and then subsequently take a binary value in the same column and use this as the selected cells value.
I am only using the formula bar for this part. The cells formula is:
"=HLOOKUP("A",A13:Z19,1)"
Row 13: SNPHUATVBKWJZYMQGXFCROEILD (Each character is assigned to an individual cell).
In row 19, each cell is taken up by 5 binary digits, so to keep things tidy I will write the decimal numbers:
10 3 2 20 18 6 24 2 12 21 30 4 6 26 19 22 9 13 5 24 0 31 12 15 24 9
The issue is that, while my formula should return 6, as that is the corresponding value within the same column as the letter "A", it returns 9, which is the first cell on the top right of the search criteria table.
Also worth noting is that if I post in a different cell a similar formula but perhaps change the search criteria to a different character such as "H", then the same error will occur, returning a 9.
Thank you so much in advance!

Partial Sums from a Given Column

I was wondering if there is a quick way to have Excel sum up chunks of a selected column based on where blanks appear in that column. For example, the column might look like:
10
12
15
11
2
3
10
13
14
14
13
1
9
8
6
and ideally each partial total would be placed where the first element being summed was previously. Can this be done without VBA?
Leave B1 empty, In B2 enter:
=IF(A2<>"","",SUM($A$1:A2)-SUM($B$1:B1))
and copy down............should look like:

Resources