Excel - count multiple words per cell in a range of cells - excel-formula

I have some cells with multiple names in them as so:
Names are not repeated in the same cell.
I have some more cells below where I need to count how many times each name appears in each column. The names of the people counted above are to the right in one column, and the number of times each name appears should be calculated in the corresponding row of the next column.
For example, the cells that read 2 and 0 should read 4 and 4 (for the amount of times they appear in the previous image).
Here is an example of the desired result:
What formula should I use to accomplish this?

You can use an array formula (Ctrl+Shift+Enter) for this. Set up your list of names somwhere (For example, F1, F2, F3 ...) then next to it (in G1):
{=COUNT(IFERROR(FIND(F1,A:A,1),FALSE))}
Assuming A is you names column. Than simply drag G1 down to copy for all names.

Related

Comparing every odd and even rows in excel

I have a very long column of strings in an excel file. I want to compare every odd and even row together. i.e to compare cells A1 and A2, then A3 and A4, then A5 and A6, etc. I do not want to split it into two separate worksheets, one containing odd number rows and the other one containing even row numbers.
Any help on this, please?
You can use the formula below. You start at row 2. Check if it is an even row then compare it with the above odd row
=IF(MOD(ROW(), 2)=0,A1=A2,"")
Update as requirement from comments, firstly, you have to insert the blank row for the formula to get value B1:
=IF(MOD(ROW(), 2)=0,A2=A3,B1)

Excel Count specifc value across range of columns, but only once per column

I have been trying to work out how to count the number of times a value appears across a range, but only once per column.
Using the example data below, the results I want to get to are shown in the end cells. Using the =COUNTIF(A3:G5,J3) counts every time a name appears, causing double-ups on some days.
How can I make it count each name once per column, but across multiple columns (there would be 1 column for each day of the year in the real data)
Thanks
in A7 enter:
=IF(COUNTIF(A3:A5,$J$3)>0,1,0)
and copy this across to G7. then in H7 enter:
=SUM(A7:G7)
You also can count values using single array formula:
=SUM(--(MMULT(TRANSPOSE(--($A$2:$G$4=I2)),ROW($A$1:$A$3)^0)>0))
Array formula after editing is confirmed by pressing ctrl + shift + enter
So the final question is 'count how many columns the name appears in'?
In which case you need a hidden row at the top or bottom of the sheet that contains everything in that column. Say it's row 1:
a) The formula in A1 would be =CONCAT(A3:A5), B1 would be =CONCAT(B3:B5) and so on (where the range covers rows 3 to 5). CONCAT sticks text strings together.
b) the cell doing the counting would be =COUNTIF(A1:G1, "*J3*"). What that does is check which cells in A1:G1 contain J3 among other things.
And voila, problem solved.

Unique values on multiple columns

I need to get a list of unique values from few columns. The data looks like this:
I tried using Unique but it only gives me copy of the list. These 4 lists are already unique values found in another sheet.
If getting unique from 4 columns is impossible, how would I go around combining these 4 columns but instead merging data from a row to 1 cell I'd like to append that one column to have one city per row (so add more rows).
Another idea I had - pulling data from multiple sheets into 1 row, but as it's an automated report, number of towns in each sheet changes every time, so can't use specific cell locations.
You can use the following formula (entered into cell F2 and assuming your data is in range A1:D5)
=IFERROR(LOOKUP("zzzzz",INDEX(IF(COUNTIF(F$1:F1,A$2:D$5),0,A$2:D$5),MIN(IF(COUNTIF(F$1:F1,A$2:D$5),"",ROW(A$2:D$5)-ROW(A$2)+1)),0)),"")
As it is an array formula it needs to be entered using Ctrl+Shift+Enter and copied down until there are blank cells
It does not work in my case, in calc (LibreOffice) that i have exactly the same problem. To extract unique values from multiple columns with text, with blank spaces. I have tried a lot of formulas with no success...
What worked for me - I dont know why this worked for me!
A, B, and C contains text from the 2nd row and onwards. Formula is put on D2 cell as Array formula.
=IFERROR(IFERROR(IFERROR(
INDEX($A$2:$A$20; MATCH(0; COUNTIF($D$1:D1; $A$2:$A$20)+($A$2:$A$20=""); 0));
INDEX($B$2:$B$7; MATCH(0; COUNTIF($D$1:D1; $B$2:$B$7)+($B$2:$B$7=""); 0))
);
INDEX($C$2:$C$12; MATCH(0; COUNTIF($D$1:D1; $C$2:$C$12)+($C$2:$C$12=""); 0))
);
"")
Found here

Excel: An array in an array?

So, I would like to return the contents of all rows where the value in column A is, let's say, 1.
My thought process is that I could use:
=INDEX(row_range,MATCH(1,A:A,0),0))
But Match will only return one value here, i.e. the number of the first row which contains a 1 in column A.
Is there a way of creating an array with the Match formula (thus returning the multiple row numbers, all of which contain '1' in column A) and then place that in the Index array so that it then runs through each of the Match-array values and creates a big long list of values in one array which I can then list out on a separate sheet?
Hope this makes sense...
Here is a demonstration of what I'm hoping for, if that helps! The idea would be that the array as shown would be created, which could then be extended down the column as per the part underneath.
https://i.stack.imgur.com/nCusM.png
Use the file you showed in your example (as "Sheet1") and put these formulas into indicated cells in Sheet2:
Into cell A2 put
=AGGREGATE(15;6;ROW(Sheet1!A:A)/((Sheet1!A:A=1)*1);ROW(A1))
this will give you all the rownumbers where value in A column of sheet1 equals 1.
Into cell B2 put
=COUNTA(INDIRECT("Sheet1!"&A2&":"&A2))-1
this will give you how many cells are filled in that row.
Into cell C2 put
=TEXTJOIN(",";TRUE;OFFSET(Sheet1!$A$1;A2-1;1;1;B2))
This will give you all the cells with data from that row concatenated. If you dont have this formula (first time in 2016 I believe) you can use OFFSET function to list the values in separate columns and then CONCATENATE them.
Copy these three down as many times as you want and into cell C1 put
=TEXTJOIN(",";TRUE;OFFSET(C2;0;0;COUNTIF(Sheet1!A:A;1);1))

Search columns and return number of cells containing "5" against colleague name

What I'm looking for is a formula that will do the following: (I'll be using the first row for this example):
Firstly check cells E:J for cells containing a 5.
If all cells contain a 5 it will check the person's name and then add this to the box in column B against the correct name.
If cells E:J have less than 5 in any of these cells it will disregard this row altogether.
To clarify, for Shaun it will count how many rows next to his name have 5's across the board then put the total number of rows fitting this criterion next to his name in Column B.
We can do this with a helper column:
Helper column, keep the name if the count of 5 equals to 5.
Enter below to K2 and fill down.
=IF(COUNTIF(E2:J2,5)=5,D2,"-")
Then we are counting how many times name appears in the helper column. Enter below to B2 and fill down.
=COUNTIF($K$2:$K$11,A2)
Create formula in K2 (output the name if all values are 5)
=IF( AND(E2=5,G2=5,H2=5,I2=5,J2=5), D2, "")
Create the formula at B2which will sum all occurrences of the names
=SUM(IF(K2:K11=A2,1,0))
(and press ctrl+shift+enter)
You maybe will need to replace , with ; (depends on your excel version).

Resources