Highlight duplicate numbers if it occurs more than once in excel - excel

Can someone please give a detailed explanation of how to do this.
I'm given a data set containing over 8000+ numbers. They are either 0 or 1 listed in the first column, 'A.' I'd like to know a formula for how to highlight any 0's if they occur 6 or more times consecutively.
I've used =Countif($A$1:A1,A1)>3 as an example, but it doesn't work. Just highlights some of the 0's. Example of what I'd like.
A1: 0
A2: 0
A3: 1
A4: 0
A5: 1
A6: 0
A7: 0
A8: 0
Any help would be appreciated.

Select from cell A6 down to the end of the column. Create a conditional format with this formu.a:
=OR(SUM(A1:A6)=0,SUM(A2:A7)=0,SUM(A3:A8)=0,SUM(A4:A9)=0,SUM(A5:A10)=0,SUM(A6:A11)=0)

Related

How to count until a certain value?

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. Would this be possible with just formulas?
Right now I am trying to use,
=COUNTIF(INDIRECT(F2:F28,0)),1)
... but it does not seem to work.
Data:
0
1
0
1
1
0
0
0
0
0
0
1
0
1
0
What you're describing here is known as a (Do) While loop in VBA.
Admittedly, something VBA is much better equipped to handle than a formula - literally needs few lines of code. Should be something you should consider looking into
You can technically fake a Do While with a formula. But this is
generally a practice I would not exactly recommend.
Under presumption you data input starts in Cell F2 then formula in adjacent Column G2
=IF(F2=0, SUM(G1, 1), 0) and drag the formula accross. Produces the expected result
In B2 enter:
=IF(OR(A2=0,A1=1),"",COUNTIF($A$1:A1,0)-SUM($B$1:B1))
and copy downward:
This seems to work according to your sample data,
=COUNTIF(F2:INDEX(F:F, IFERROR(AGGREGATE(14, 7, ROW($1:2)/(F$1:F2=1), 1), ROW(F2))), 0)
I have a solution, but it's not very elegant. Maybe someone else can improve on it. But here it is:
Assuming your data is in column A.
1) In B1 enter a 1 if A1 is a 0 or 0 if A1 is a 1.
2) In B2 enter the formula =IF(A2=0,B1+1,0)
3) Drag the above formula all the way down
4) In C1 enter the formula =IF(B1>B2,B1,"")
5) Drag the above formula all the way down
6) Column C should now have all of the counts of zeroes.
You can use the following formula in column B:
=IF(A3=1,COUNTIF(A$1:A2,0)-SUM(B$1:B1),"")
starting in row 2 and drag it down.
Put 1 in the cell next to the first 0 (In my example that's in A1, so i've put 1 in B1);
Then try this =IF(A2=A1;B1+1;1)

How to repeat a value each x cells?

The idea is to have 2 inputs the number and the number of spaces, so lets say those numbers are 2 & 3 it should look like:
2
0
0
0
2
0
0
0
2
If first parameter is in A1, second in B1, you can enter the following formula in any cell, and fill it down:
=IF(MOD(ROW(A1),$B$1+1)=1,$A$1,0)
Your sample data is confusing in that there are three 2's and three zeroes. It's unclear on what it should look like if the second number was a 4. If it is always three of the first number try something using REPT. With 2 in A1 and 3 in A2,
=A1&rept("0", A2)&A1&rept("0", A2)&A1
Pick a cell and enter:
=IF(MOD(ROWS($1:1),4)=1,2,0)
and then copy down:

How to count number of matches between two columns in Excel?

How to count number of matches between two columns in Excel?
For example if we have:
1 1
2 1
3 2
4 4
5 3
I need to get either a column like this:
1
0
0
1
0
and then I can sum the ones in there to get the count of matches.
Option 1: IF
=IF(A1=B1;1;0)
This formula will put 1 in the cell if A1 = B1, and 0 otherwise.
Option 2: COUNTIF
Write =A1=B1 in C1, etc., in the column cells. This will fill the C column with TRUE and FALSE values.
At the bottom of that column, add a cell =COUNTIF(C1:C100;TRUE) so that you count the cells between C1 and C100 which have value TRUE.
You may find the TechRepublic article Use COUNTIFS() to compare two data sets in Excel of use. See also Microsoft's documentation on countifs().

EXCEL formula with multiple conditions

I am in turmoil of IF, OR and AND in Excel formula.
Basically, I have two different cells. I want to first check that each cell is have Text or Number and if its having either of it, then I want to compare both cells and display the result in Third cell.
So it would be like
IF
Cell A2 --> Check if it contains Text or Number
AND
Cell B2 --> Check if it contains Text or Number
THEN
Cell C2 --> Compare A2 and B2
Example 1: Positive
A B C
1 abc123 abc123 PASS
Example 2: Negative
A B C
1 abc123 abc113 FAIL
Example 3: Negative
A B C
1 113 113 FAIL
I hope above example will help.
So far, I've tried:
=IF((IF(OR(ISNUMBER(A2),ISTEXT(A2)),A2,""))=(IF(OR(ISNUMBER(B2),ISTEXT(B2)),B2,"")),"PASS","FAIL")
In above example, if I leave any cell empty, still it is showing Pass.
Thanks in advance...
=IF(AND(OR(ISNUMBER(A2), ISTEXT(A2)), OR(ISNUMBER(B2), ISTEXT(B2))), IF(A2 = B2, "PASS", "FAIL"), "")
I would use:
=IF(AND(ISNUMBER(A1),ISNUMBER(B1),A1=B1),"Pass",IF(AND(A1<>"",B1<>"",A1=B1),"Pass","Fail"))

Microsoft Excel 2010: Help making a Formula to up Values by a repeating pattern

I have a Spreadsheet, and inside this sheet contains a column with numbers, I want to make a formula that will go down that Column and do basically this.. Values: 1 will be 9.50. 2 will be 9.75. 3 will be 10.00. Ect going up to Value of 100? Is that possible for a Formula? I keep playing with it but can't really seem to get it down. Any help would be appreciated.
Column A: 1
1
1
1
1
2
2
2
2
2
2
2
2
2
3
3
3
3
There is not a set amount to how many values are in there.
this should do it supposing that column A has these values 1, 2 ...etc that your computing will be based on
=MIN(9.25+A1*0.25;100)*COUNT(A1)
In A2, enter the formula
=A1 + (9.5-A1)
then in the cell just below it (A3), enter
=A2+0.25
Assuming A1 is the top left. Copy the formula in A3, select the next 399 cells and paste. Then select A2 - A364 and copy. Then select B2 -xx364 and paste. xx is the last column with data. If you want, set the height of your first column to 0 to hide it.
=(A1-1)*0.25+9.5 where A1 contains any number you want

Resources