Count the cells that value in excel - excel

I want to get the count of cells in each row that has a value in it.
ross dan bernard 3
mary 2
rose johnny 2
I want a formula that gives counts the non blank values in each row and gives the value in column E (ie., 3,2,2)

You can use the CountA function:
=COUNTA(A1:Z1)

Related

Ranking Duplicate String Values in Excel

I have a spreadsheet with string values and need to create a column with the rank (without using the rank function) of the duplicate values from another column.
Please see below for example of the desired outcome where Dupe_Rank is the created column.
Thanks!
Name
Dupe_Rank
John
1
John
2
Dave
1
John
3
Bill
1
Dave
2
let's say "Name" starts from column 'A' and row 2 as in below figure:
then add this formula:
=COUNTIF(A$2:A2,A2)
to cells below Dupe_Rank and then drag(or copy-paste) this formula to all the cells

Return row number from Excel sheet based on filters

I have the following excel file with two sheets namely Sheet1 and Sheet2. Sheet1 contains few names with repetitions like below.
Column E
-------- ----------
Row 3 tom
Row 4 jerry
Row 5 mick
Row 6 tom
Row 7 john
Row 8 mike
Row 9 mick
Row 10 eric
Row 11 matt
Row 12 mike
I want to be able to determine the row in which, for example, the second occurrence of the name "Pete" occurs. For this I have to set up a new worksheet (Sheet2) that will allow me to enter a person's name and a positive integer (such as n), and returns the row in which the name occurs for the nth time.**
Enter Name : tom (cell B1)
Enter Integer :
Result : `2`
For the result cell I have applied the below formula which is returning the no. of times the name occurs.
=COUNTIF(Sheet1!E3:E12,Sheet2!B1)
But I am not been able to find the desired answer.
Can it be done to with Countif, Countifs, Count, CountA, and CountBlank Functions?
Can anyone please help?
=AGGREGATE(15,6,1/(myRng=B1)*ROW(myRng),B2)
Explanation
myRng=B1 match each entry in myRng with the name in B1 giving an array of TRUE;FALSE
1/… changes that to an array of {DIV/0,1,... depending on whether it matches
*ROW(myRng) converts that to an array of {DIV/0, row_num}
AGGREGATE(15,6,resultant_array,B2) returns the nth smallest value from that array, ignoring the errors

Excel: How to add a column from other sheet based on a key column?

I have 2 list. Both have a lot of column. I would like to insert a column from Sheet2 to Sheet1 based on a ceratin key column. Also sheet2 have much more rows than sheet1 so it ll be inserted only partly and still there ll be elements with no matches. For an example:
Sheet1:
Names ID Car Color
John 1 Audi Empty
Andy 4 Toyota Empty
Mike 3 BMW Empty
Tony 2 Suzuki Empty
Sheet2:
ID Cost Color
6 200 Blue
3 200 Red
4 300 Green
5 100 Red
1 50 Black
I would like to get the "color" from Sheet2 to Sheet1 by using the "ID". Using Excel 2010. I suspect I need INDEX+MATCH combination, but the examples I can find are not detailed and more simple so I coudn't figure out how to use them.
How about inserting this formula on Column D in the first row, then dropping the formula down:
=VLOOKUP(B1,Sheet2!$1:$1048576,3,FALSE)
Or to find the column that contains "Color", use Index Match Match, as follows:
=INDEX(Sheet2!$1:$1048576,MATCH(Sheet1!B2,Sheet2!A:A,0),MATCH("Color",Sheet2!$1:$1,0))
This will find the value in Column B in Sheet2 and give you the row number, then it will find the Column that contains "Color" and return the Column number, with those two numbers Index will return your color.

COUNTIFS with range criteria on different sheets

I have not read if there is a limitation with COUNTIFS function, but I am experiencing the following:
I want to count the number the number of times two conditions are true in a row. For example
Sheet 1
USERID DATE
SAM 12/1/2014
SAM 12/3/2014
SAM 12/4/2014
JON 12/3/2014
BOB 11/5/2014
Sheet 2
Dates to match against {12/3/2014, 12/4/2014, 12/5/2014}
Sheet 3
USERID DATECount
SAM 2
JON 1
BOB 0
If all this information is in the same sheet the following formula works (Assuming data in Sheet 1 is in columns A and B, and the data in Sheet 2 is in the first row D to F, and the data in Sheet 3 starts at D5.
=COUNTIFS(A:A,D5,B:B,"="&$D$1:$F$1)
Currently, to get over this, I have a SUM function and a COUNTIFS for each criteria in the range for criteria 2. But it's pretty ugly since there are 20 criteria.
What I trying to find is a more elegant way to do this, or if there is another function that can return the same results.
Note that the date range can change every month.
You need a SUMPRODUCT wrapper that will iterate the COUNTIFS results through the cells in Sheet2!$D$1:$F$1.
      
The formula in Sheet3!E5 is,
=SUMPRODUCT(COUNTIFS(Sheet1!A:A,D5,Sheet1!B:B,Sheet2!$D$1:$F$1))
Fill down as necessary.

Excel sort table value and return row names of the 5 largest rows

As stated in the title, the table has two columns, one for row names and the other is for values, I just want to return the row names and values of the 5 rows with the largest value accordingly back to another range of cells. (It will be better if I don't have to operate the table)
Thank you very much!
for example the table is like:
Johnny 1
Harry 2
Jessie 3
Luke 4
Mary 2
Lucy 1
Peter 5
Basically I would like the ouput to be
Peter 5
Luke 4
Jessie 3
Harry 2
Mary 2
The fifth biggest number you get like this
=LARGE($B$1:$B$10;5)
and then you will find the row number of this value with MATCH and use this in INDEX to get the text value
=INDEX($A$1:$A$10;MATCH(LARGE($B$1:$B$10;5);$B$1:$B$10))
Now this will not work, if you have values appearing twice. Then an additional column could help or some more complicated trick for the MATCH part, like
MATCH(LARGE(B1:B10-ROW(B1:B10)/1000;1);B1:B10-ROW(B1:B10)/1000;0)
And then you have to make an array function out of the formula but pressing CTRL+SHIFT+ENTER not only ENTER. Then {} will be added around the formula.

Resources