How to count the number of times text is repeated [duplicate] - excel

This question already has answers here:
Numbering/sequencing sets of same column values
(2 answers)
Closed 7 years ago.
I have a data like
A
B
A
D
C
E
C
A
I want that when A is repeated I get the number of time(freqency) it gets repeated.
So data set should read like this
A 1
B 1
A 2
D 1
C 1
E 1
C 2
A 3
I need to know a formula which can help me identify the count beside the text and nth number of time it got repeated.

If data is in column A. Put in Cell B1 and drag down:
=Countifs($A$1:$A1,A1)

Related

Excel Compare values from two tables and copy data [duplicate]

This question already has answers here:
Excel Lookup function for text [duplicate]
(2 answers)
Excel formula to copy data adjacent to a cell and paste it next to a duplicate cell in another column
(2 answers)
Excel Formula for Inventory
(1 answer)
Excel - find cell with same value in another worksheet and enter the value to the left of it [duplicate]
(2 answers)
Check if an excel cell exists on another worksheet in a column - and return the contents of a different column
(1 answer)
Closed 1 year ago.
I have a small Excel task that I am stuck on.
I have two Excel tables and would like to fill table 1 with values from table 2.
Example:
Table1:
A
B
C
D
E
1
Dude
2
Table2:
A
B
C
D
E
1
Max
Muster
Way
3
53
2
Dude
Test
Street
42
44
The formula should now copy the value from Table2 B2 in Table 1 for B1.
This means that the formula must find the correct row in table 2 using the value in table 1 A1 and copy the value from column B.
Does anyone have any ideas?
An easy way would be using INDEX and MATCH:
My formula in column I is:
=INDEX($B$1:$E$2;MATCH($H1;$A$1:$A$2;0);1)
Notice last argument of INDEX is 1 for column I, 2 for column J, 3 for column K and so on. Depending on where is your data you may need to adapt this part. And for sure you can use another formula to autoselect proper column instead of typing 4 different formulas, but as I said, this would be the easiest way (not the cleanest, tough)

Excel Data convert from single row to multiple row

I have data in excel in following manner.
Colname Count
A 5
B 3
C 4
I want to convert it into this way.
A 1
A 2
A 3
A 4
A 5
B 1
B 2
B 3
C 1
C 2
C 3
C 4
Based on the count i want that data must be converted into rows with increasing order. Please let me know the feasiblity .
=IF(ROW()<B$1+1,"A",IF(AND(ROW()>B$1,ROW()<SUM(B$1:B$2)+1),"B",IF(AND(ROW()>SUM(B$1:B$2),ROW()<SUM(B$1:B$3)+1),"C",""))) in F1 and fill down. In G1, this formula =IF(COUNTA(F1)>0,COUNTIF(F$1:F1,F1),"") and fill down. Letters are in Column A and numbers in Column B. I chose these columns randomly to work a solution. Change to match your actual data, if needed.

EXCEL: Color cell if column is "nth" in the row

Here is an example excel table
Row# A B C D E F G
1 Q# Ans Student Answers
2 1 4 0 3 1 4 2
3 2 2 1 7 9 2 0
4 3 3 5 1 1 3 8
Column A stores the question number, Column B is the index of the correct scantron answer (1-5 for A-E).
Columns C-G are sums of the student's answers and how many of them answered each option, so for example:
Question 2, the correct answer was B (because column B is stored as
2). C-G say that 1 student answered A, 7 answered B, 9 answered C, 2
answered D and none selected E on the scantron.
With each exam, the values in column B change around. I would like a way to conditionally format columns C-G so that only the nth column is colored (as dictated by whatever the number of A is). So for question 2, it would color the cell at D3 green or something.
I tried to figure this out with conditional formatting, but I can't say if the values match column B, because B is a indicator for which column is correct, not a value to match in each column.
I'm comfortable implementing VBA code, so that works as well, I'm just not familiar enough with it to know how to construct the proper code to insert into my spreadsheet.
Put the answer number accross the top of the data in row 1:
Then you can use the following formula:
=MATCH($B2,$1:$1,0)=COLUMN(C2)
And apply it to the answer statics area, in this case $C$2:$G$4
Or if your answer statistics always follow the Ans column you could use this formula for the same result:
=COLUMN($B2)+$B2=COLUMN(C2)
Without the need of the title row.

Find maximum of row, return column name

I have four rows and six columns of random numbers between 1 and 10. The headers atop are named A through F accordingly. I want to populate a range (A1:A6) on another sheet with the maximum number for each row. That is easy with the MAX function. However, in a another range (B1:B6), I want to put the column name to which this number belongs.
An HLOOKUP() won't work because a maximum value in one row is likely not unique number across the entire sheet. I am thinking a MATCH INDEX type function, but my understanding of those functions, especially in conjunction, is poor.
A B C D E F
1 0 2 10 9 8
9 3 7 6 9 10
10 3 0 2 1 4
9 4 7 8 6 3
Assuming your array is in Sheet1 and the columns are labelled, please try in another sheet, copied down to suit (to Row4 since there are only four rows of numbers in your data):
=INDEX(Sheet1!A$1:F$1,MATCH(MAX(Sheet1!A2:F2),Sheet1!A2:F2,0))
This will return only the first column label from a row where the maximum for that row occurs more than once.

EXCEL match 2 columns against each other

I have two columns of data, they look something like this:
A B C D
1 2 SOME RECORD
2 6 SOME RECORD
3 10 SOME RECORD
4
5
6
7
8
9
10
So basically column A is a list of indices, where some of them appear in column C with corresponding records saved in column D. Column B is currently empty, and what I want to do is if say index 2 appears in both column A and column C (they matches), then put the record beside C2 in the cell B2. So essentially I want it to look like this:
A B C D
1 2 SOME RECORD
2 SOME RECORD 6 SOME RECORD
3 10 SOME RECORD
4
5
6 SOME RECORD
7
8
9
10 SOME RECORD
Can someone help please?!! Thanks!!!
UPDATE: I tried this and it doesn't work. The data in column D is calculated using a UDF and is refreshing every 1 second. The VLOOKUP function fails even though I can see the 2 indices are the same!! Is it because of the format of the cell or column? I.e. does vlookup compare data type as well?
Assuming your data in A starts from A1 - put in B1 the following and autofill:
=IFERROR(VLOOKUP($A1,$C:$D,2,0),"")
This includes handling of missing values.
You'll want this:
B1=VLOOKUP(A1, C:D, 2, FALSE)
This will look up the value in column A within the array spanning columns C and D. It will give you the value found in the second column (D). FALSE makes it an exact match, otherwise you might get 2 and 20 matching because hey, they're kind of similar...

Resources