I have course listings with detailed description. I have 25 keywords in order to filter particular type of course. I want to count the number of courses with the description containing more than 3 keywords. Can anyone help me how to do it?
One way...
Say course descriptions are in column A with heading in A1 and descriptions below in A2, A3, etc. Then, next to the header in following columns, we'll assume C and on to the right here, type in the keywords. Then:
//copy these down and to the right
In cell C2: =IFERROR(IF(FIND(C$1,$A2)>0,1,0),0)
Now of these cells under C2 and on to the right will have a 1 if the keyword matches the heading above that cell, a 0 if not. Then, just sum the columns in row be:
// copy these down
In cell B2: =if(SUM(C2:AD2)>2,1,0)
This column B will now show a 1 beside each course with 3 occurrences or more, a 0 for any with less. Now, just sum this column B for the total number of courses:
=SUM(B:B)
Note, this counts occurrences of a string. Thus a search for "and" would return to in the entry "random and unusual." Just a warning...
Fill the Excel spreadsheet as follows:
Row 1:
A1: Description. Below there will be descriptions of your courses.
B1, C1, ... Z1 (next 25 cells) - Keywords to find in descriptions.
AA1: Sum. Below will be numbers of keywords found in each description.
Column 1:
A2, A3, ... - Course descriptions.
Row 2 - Formulas for course 1:
B2: Insert formula: IF(ISNUMBER(SEACH(B$1;$A2));1;0)
Note $ characters in the formula above: B$1 - fixed column (1)
and $A2 - fixed row. This is required to keep column / row fixed,
as the formula will be copied (description below).
Copy the above formula to cells C2:Z2.
This way you have in each cell either 1 if the keyword above
(in row 1) was found in course name (in column 1).
AA2 (sum column): Insert formula: SUM(B2:Z2). This way in column AA
you have the number of keywords (from row 1) found in
description (in column A).
Copy formulas from A2:AA2 to each following row with description filled.
Assuming that you have 100 such course descriptions, you have
till now filled:
Row 1 with header data.
Rows 2 to 101 with descriptions (column A) and formulas
(further columns).
Then, in cell AA102 (below the last sum) enter formula:
COUNTIF(AA2:AA101;">3") - count cells containing value more than 3.
This is the result you are looking for.
If you have more or less course descriptions, change the above
formula (and its location) accordingly.
And the last remark: I used non-English version of Excel and then
"manually" translated my native function names into English.
So in case of function name errors try to figure out what actual function
name should be.
Related
I need a formula in Excel that will count the number of unique IDs in one column if the value of another columns matches what is in a specific cell in a third column.
COLUMN A - Code 1, COLUMN B - ID Number, COLUMN C - Code 2, COLUMN D Number of Unique Firms by Code, COLUMN E - What the formula should return as answers
Desired Formula - Count the number of unique ID Numbers in B anytime C (Code 2) matches what is in cell A2 (From Column Code 1)
Then do the same for cell A3, A4, etc.
Notes:
I am working across multiple Excel sheets and there are close to 200,000 rows, but for simplicity sake I am putting everything in one sheet and only 15 rows on the image.
I have Microsoft Home and Student 2019
In D2 enter this array-formula with ctrl+shift+enter and drag down:
=SUM(--(FREQUENCY(IF($C$2:$C$15=$A2,$B$2:$B$15),$B$2:$B$15)>0))
It counts the number of unique values in B2:B15 where the value in C2:C15 equals the value of code1 in the current row.
I asked a question a few hours ago and now I'm trying a different approach on the same issue.
I want to get the largets numbers from a table and the corresponding description.
The selected cell has the formula =LARGEST(S:S,1), =LARGEST(S:S,2) and so on...
The issue is that 4 and 5 is the exact same value which makes my INDEX MATCH formula (=INDEX(P:P,MATCH(U5,S:S,0)) U5 is selected cell) in the cell adjacent to the selected cell find the same product twice.
But if we look in the table to the right which is a copy paste values so that it can be sorted, 4 and 5th largest values are not the same product.
Can I somehow change the index match formula to the n-th of the same value so that it's "correct"?
This is a common problem. You must remove ties so your INDEX(MATCH()) can find all the matches. Consider:
Note the both Patricia and Mary have the same scores. In C2 enter:
=RANK(A2,$A$2:$A$11,0)+COUNTIF($A$2:$A2,A2)-1
and copy downwards. Column C tracks column A, but has no ties! (a simple sequential list with no duplicates or gaps)
Finally in E2 and F2 enter:
=INDEX($A$2:$A$11,MATCH(ROWS($1:1),$C$2:$C$11,0))
=INDEX($B$2:$B$11,MATCH(ROWS($1:1),$C$2:$C$11,0))
and copy these downwards.
I am trying to search from inside spreadsheet 1 into spreadsheet 2 for 2 things that must be true and if so, pull back another column row.
I want to search column A for the number 12345 and column B for the string "GBP" but I do not know what row 12345 and "GBP" will occur on. If found (there can only ever be 1 result returned so don't worry about multiple results) I need to return the value in column C.
The thing is - I am finding this tricky. Can you help me please?
Create a column C where each cell to the right of data contains the formula
=IF(AND(A2=12345,B2="GBP"),1,0)
When you have copied that formula into each cell down the entire column, search that column for a "1". The "1" is what you are looking for.
As long as there is 1 row matching the criteria, you can use SUMIFS function to get the value from the matching cell:
assuming A2=12345 and B2="GBP" on the current sheet,
sum all values on Sheet 1 column C where both columns A and B match the specified criteria:
=SUMIFS(Sheet1!C:C,
Sheet1!A:A, A2,
Sheet1!B:B, B2)
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).
I am trying to find a value within an array and then return the value in a specific row in the corresponding column.
In the example below, I need to know which bay the Chevrolet is in:
Column A Column C Column D Column E
Chevrolet Bay 1 Bay 2 Bay 3
Toyota Ford Saturn
Honda Chevrolet Jaguar
Ferrari Subaru Lexus
Mitsubishi Hundai BMW
I am looking for Chevrolet in the array C2:E5. Once it determines that the Chevrolet is in Column D, I need for it to return the value in D1. If it was in column E, I need it to return the value in E1.
Any help would be greatly appreciated. Thank you so much in advance.
Try this Array Formula:
=INDEX($C$1:$E$5,1,SMALL(IF(NOT(ISERROR(SEARCH(A1,$C$1:$E$5))),COLUMN($A:$C),99^99),1))
or if you are sure that each column contains exactly what's being searched it can be written like this:
=INDEX($C$1:$E$5,1,SMALL(IF($C$1:$E$5=A1,COLUMN($A:$C),99^99),1))
Enter formula in any cell by pressing Ctrl+Shitf+Enter.
How does it work?
Our ultimate goal is to find the Column that contains the match:
First we did the search for the match using this formula: SEARCH(A1,$C$1:$E$5). It just checks if any of the entries matched A1. Actually, it can be simplified to $C$1:$E$5=A1 but I'm not sure if all entries in each column match exactly what's in A1.
That formula will produce an array of values when entered as array formula. Something like: {SEARCH(A1,C1), SEARCH(A1,D1), SEARCH(A1,E1);... SEARCH(A1,E5)}. The result will be array of number(s) and error (if non was found). But we don't want that, else we will be returning error everytime.
We then use IF(NOT(ISERROR(SEARCH(A1,$C$1:$E$5))),COLUMN($A:$C),99^99). This formula returns the Column Number if there is a match and a relatively huge number 99^99 otherwise. Result would be: {99^99, 99^99, 99^99, 2, ..., 99^99}.
And we are close to what we need since we already have an array of Column and huge number. We just use SMALL to return the smallest number which in my opinion is the lowest Column Number where a match is found. So SMALL(IF(NOT(ISERROR(SEARCH(A1,$C$1:$E$5))),COLUMN($A:$C),99^99),1) would return 2. Which is the column where Chevrolet is referenced at $C$1:$E$1.
Since we already have the column number we simply use INDEX Function which is: INDEX($C$1:$E$5,1,2).
Note: 99^99 can be any relatively large number. Not necessarily 99^99. Actual 16385(max column number in Excel 2007 and up + 1) can be used.
Result:
Another quick and dirty answer is to put a "dummy" row above the entire data set and then determine which placeholder column returned the correct result.
In B1, you can put the equation
=MATCH($A$2,B3:B6,0)
And then in C1, you can put
=MATCH($A$2,C3:C6,0)
And so on until you've covered all the rows and columns. Change the B3:B6 & C3:C6 to reflect the actual rows of data in the given column.
Now, the fun array formula which will actually return the bay. I have this array formula in cell A1 and it is looking from B1:D1, but you can move cell A1 anywhere you want and the B1:D1 range should be all the dummy columns you made above. Also, this is assuming that the bays you want are in row 2 (if they are in a different row, change R2C to R#C where # is the row number). In order to properly enter, enter the formula and then press CTRL+SHIFT+ENTER.
=INDIRECT("R2C"&SUM(IF(ISERROR(B1:D1),FALSE,B1:D1))+1,FALSE)
If the formula is entered properly, it will show curly brackets { } around the equation when you single click on the cell.
This formula will do it, assuming that the lookup value is in A1:
="Bay "&SUMPRODUCT((B2:D5=A1)*(COLUMN(B2:D5)))-1
You could easily adjust it to add more rows and columns.
The formula returns the column number that contains the lookup value and concatenates it with the word Bay to return the exact result you want.
The -1 at the end adjusts for the fact that the Bay 2 column is actually the third column in the worksheet, so you might need to adjust that offset as well.
The SUMPRODUCT function is much undervalued. More on it here:
http://fiveminutelessons.com/learn-microsoft-excel/multiply-two-columns-and-add-results-using-sumproduct
The SUMPRODUCT formula above is perfect for what I want.
E.g. to find the location - COLUMN and ROW - of a given value at A1 in a 2D Range A2:J44
use: =SUMPRODUCT((A2:J44=A!)*(COLUMN(A2:J44))) gives the Absolute* COL#
and : =SUMPRODUCT((A2:J44=A1)*(ROW(A2:J44))) gives the Absolute* ROW#
(not where it is in the range)
These can then be used in e.g. INDEX() or CELL() etc functions.