Count duplicates and display order of occurence - excel

I am attempting to count the number of occurrences of each value within a column and then output the order in which it was found (top to bottom) with unsorted data. I have been unable to find a suitable formula to accomplish this task. Any assistance is greatly appreciated.
Example:
Number DuplicateIndex
50 1
20 1
30 1
10 1
30 2
40 1
30 3
50 2

Try,
=countif(A$2:A2, A2)
, in B2 and fill down.

Try,
In B2 and fill down
=unique(A2:A9)
In C2 and fill down
=countif(A$2:A9, B2)

Related

COUNTIF to calculate number of occurances between 2 values

I have no idea what is wrong with my formula and I would like to learn from my mistakes:
I have a range of values, say A1:A100, and I want to count the number of times a value from 0 to 10 appears, 10 - 20 appears etc. and put it into a frequency table.
I am put value 0 and 10 in cells B1 and C1 respectively, 10 and 20 in B2 and C2 respectively etc. (i.e. the frequency table is from columns B to D)
In D1, my formula is:
=COUNTIF($A$1:$A$100,AND(">="&B1,"<="&C1)
However, this formula doesn't seem to work and always returns 0. It would be greatly appreciated if anyone can enlighten me on why my formula doesn't work. Thanks in advance!
Use COUNTIFS for multiple conditions.
=COUNTIFS($A$1:$A$100, ">="&B1, $A$1:$A$100, "<="&C1)

Searching for neighboring cells

I am dealing with a large data set in Excel and need to search a for two neighboring cells in the same column. Usually I would just go through this quickly row by row, but there are around 30,000 rows and probably 1% of those are the neighbors I am looking for. The data is organized temporally, meaning I cannot just sort.
Anyone have an idea if/how this can be done?
You could drag down this formula in column next to your data.
For example, in B3 where column A has data:
=IF(AND(A3<>"",A2<>""),"neighbour above","")
So:
Row A B
1 Data Check
2 10
3 20 neighbour above
4
5 40
6 50 neighbour above
7 60 neighbour above
8
9
10 90
Note B2 first position has no formula. This will highlight neighbouring cells within the column.
How many?
To count how many neighbours, use a countif. so in C1 you can have:
=COUNTIF(B:B, "neighbour above")
which will return 3 in this case above. pairs 10 and 20, 40 and 50, 50 and 60.
You can choose other marker text to flag the neighbour, besides "neighbour above". Just put it in the IF statement.

Excel countif(s) multiples

I'm trying to calculate the count of multiple occurrences of a figure using countif.
I have the range set but I need a calculation which can count in multiples of 50 without me having to type thousands of versions of countif (=COUNTIF(B2:B5,">=50")-COUNTIF(B2:B5,">100" etc.).
Data Count
50 1
70 1
80 1
10 0
150 3
This data should show 6 but at the moment I'm getting 4.
First you can start by making bins. you can make it with Data analysis tool or half manual
Like in the example, on A2 enter 0 and on b2 enter =a2+50
Same goes for a3 enter =b2 and last on a4 =a3+50
Now you can drag it down as much as you like.
Instaed of using countif use sumif finction. let's assume your data is on cloumn H and the values you want to sum are in column I, then on c2 enter
=SUMIFS(I:I,H:H,">"&A2,H:H,"<="&B2)
you can drag it down as much as you like.
Simply use Excels ROUNDDOWN function:
e.g. for B2: =ROUNDDOWN(A2/50,0)

Nested IF Excel formula

I am currently using the following formula i.e. =IF(COUNTIF($A$1:A2,A2)>4,A2+1,A2) to change the number when I drag this formula downsdie of the rows.
For Example: in this case for every five rows number will change i.e. A1 to A5 it will 1 and A6 to A10 it will be 2 and A11 to A15 it will be 3 etc.
Just wanted to know is it possible to extend the same formula, so along with adding 1 number for every five rows it should also skip 2 numbers for every 60 rows.
For Example: if the 60 row is number 12, then 61st row should be 15 and 120 row will be 26 and 121 row should be 124 etc.
Can someone please help me with this formula?
Thanks for your help in advance.
Number starts at one.
Then get the cell's row number and subtract one. Divide that number by 5 and discard the fractional part (or the remainder). So numbers from 0 to 4 (which are rows 1 through 5) all get an increment of 0, 5 to 9 get 1, and so on. Similar logic with multiples of 60 except that the counting is doubled.
=1 + floor((row()-1)/5, 1) + floor((row()-1)/60, 1) * 2

Take the group average

I've two columns: A and B; for each 3 rows in A column, I want to take the average of that 3 rows and write to B. here is the example:
A B
10 20
20 50
30
40
50
60
I need the excel formula of this calculation. Thanks in advance
Suppose your data in column A are in range A1:A100, then use following formula, say in B1:
=AVERAGE(INDEX($A$1:$A$100,3*(ROW()-ROW($B$1))+1):INDEX($A$1:$A$100,3*(ROW()-ROW($B$1)+1)))
and drag it down

Resources