Counting past occurrence given a classification - excel
I have a Table just like the one in the picture below. I want to count the number of cells in the column Leg since the last entry, given a certain classification on the column Type.
For example, for the type KFT only, how many blank entries are there in the column Legendary since the last entry for Leg?
I know how to solve this issue creating helper columns. But given that I have too many types, I would have to create a helper column for each type, making my table too big given the amount of rows I have. Is there any way I can create a VBA function to perform this task for me, such that I only need one cell per type to let me know the amount of blank cells since last Leg entry for each type? Here is a short example of how my table looks, using only 2 types:
In this example, I need a formula with output 0 for MSG, since it has been 0 entries since the last Leg for MSG, and output 2 for UNG, since it has been 2 entries since the last Leg for UNG.
Thanks so much for the help!
Solution 1 Using single scary formula
Alright then. I think best solution to your problem is using helper column or VBA but if you really want to use just one formula, I've something for you. This formula is very very scary and someone might give you better solution also, but this formula does work.
In the below formula I've assumed data to be in range A2:F100. Change 100 to you number of rows of data. (change all 100's, best way will be to copy formula without = in an empty sheet and then FIND 100 and REPLACE ALL to your row number)
If you have listed Types in Column H starting from Cell H2 then in Cell I2 enter the following formul, drag/copy down as required.
=COUNTIFS(INDIRECT("F" & INDEX($A$2:$A$100,MAX(IF(($B$2:$B$100=H2)*($F$2:$F$100=1),ROW($B$2:$B$100)-ROW(INDEX($B$2:$B$100,1,1))+1)))+1 & ":F" & IF(INDEX($A$2:$A$100,MAX(IF(($B$2:$B$100=H2)*($F$2:$F$100=1),ROW($B$2:$B$100)-ROW(INDEX($B$2:$B$100,1,1))+1)))+1>INDEX($A$2:$A$100,MAX(IF(($B$2:$B$100=H2)*($F$2:$F$100=""),ROW($B$2:$B$100)-ROW(INDEX($B$2:$B$100,1,1))+1)))+1,100,INDEX($A$2:$A$100,MAX(IF(($B$2:$B$100=H2)*($F$2:$F$100=""),ROW($B$2:$B$100)-ROW(INDEX($B$2:$B$100,1,1))+1)))+1)),"",INDIRECT("B" & INDEX($A$2:$A$100,MAX(IF(($B$2:$B$100=H2)*($F$2:$F$100=1),ROW($B$2:$B$100)-ROW(INDEX($B$2:$B$100,1,1))+1)))+1 & ":B" & IF(INDEX($A$2:$A$100,MAX(IF(($B$2:$B$100=H2)*($F$2:$F$100=1),ROW($B$2:$B$100)-ROW(INDEX($B$2:$B$100,1,1))+1)))+1>INDEX($A$2:$A$100,MAX(IF(($B$2:$B$100=H2)*($F$2:$F$100=""),ROW($B$2:$B$100)-ROW(INDEX($B$2:$B$100,1,1))+1)))+1,100,INDEX($A$2:$A$100,MAX(IF(($B$2:$B$100=H2)*($F$2:$F$100=""),ROW($B$2:$B$100)-ROW(INDEX($B$2:$B$100,1,1))+1)))+1)),H2)
This is an array formula so commit it by pressing Ctrl+Shift+Enter.
Solution 2 Using Helper Columns
Assuming you listed all Types in Column H starting from Cell H2 then in Cell I2 enter the following array formula to get the last row from data for corresponding Type in Column H and Leg =1
=INDEX($A$2:$A$11,MAX(IF(($B$2:$B$11=H2)*($F$2:$F$11=1),ROW($B$2:$B$11)-ROW(INDEX($B$2:$B$11,1,1))+1)))+1
Then in Cell J2, enter the below array formula to get the last row from data for corresponding Type in Column H and Leg ="" (blank)
=INDEX($A$2:$A$11,MAX(IF(($B$2:$B$11=H2)*($F$2:$F$11=""),ROW($B$2:$B$11)-ROW(INDEX($B$2:$B$11,1,1))+1)))+1
Next, in Cell K2, enter the below formula to set last row if there's no row corresponding to particular type for which leg is blank (for example in my sample data ABC do not have empty Leg)
=IF(I2>J2,11,J2)
Finally, in Cell E2 enter the following formula to get Count
=COUNTIFS(INDIRECT("F" & I2 & ":F" & K2),"",INDIRECT("B" & I2 & ":B" & K2),H2)
Related
Countif or sumif function in Excel
I have 2 tables, one which gets populated with results (on the right) and the other is the summary of that results table (on the left). Not even sure if countif is the correct approach but I just wondered if there was a formula I can put into B2:D3 which can add up the number of occurences in the results table. So going forward I'll just need to manually insert another row in columns I and J which would update B2:D3
Use this as shown in image below, going forward when you add more values in column I & J, it shall give you the number of occurrences of L, W, & D respectively as per Name Enter the formula in cell B2 & Fill Down -- Fill Right =SUMPRODUCT(($A2=$I$1:$J$1)*(B$1=$I:$J)) What this formula does is creates an array of TRUE's & FALSE's, select the Array 1 & Press F9, ($A2=$I$1:$J$1) {TRUE,FALSE} likewise for the Array 2 as well (B$1=$I:$J) {FALSE,FALSE;TRUE,TRUE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,FALSE;FALSE,) Each Array 1 will be multiplied by corresponding Array 2 and returns the sum of the products, by far this is safest option and can be used in all Excel Versions.
You can add the following formula into B2: =COUNTIF($H$2:$H$3,B$1) It will count all 'W' occurrences in the H2:H3 range. You can drag this formula to the right. For the B3 cell, you need to update the column from H to I.
How to increment duplicate values from 1 to n by criteria?
let's say I have a list of duplicate values in a column such as:AAABBAACABC. ...AAC. Then I want Excel to Rank respectively the first A as A1,the first B as B1 the second A as A2 and the second B as B2 and so forth until the A(nth) and the B(nth). And any additional A should automatically Rank as A(nth+1). Same thing for B C etc. note that I should be able to enter any new value such as X that will automatically Rank as X(nth+1) or X1 if it did not exist in the table before. Hoping that I made myself understood. I am waiting for anyone to help me. VBA or array formulas I have no preference once I can realise what I want. Note that I found a way by sorting them in accending order but it can't match for any additional value at the end of the data base. Thanks.
I am assuming your data is in Column "A". Enter the formula in Column "B" and copy the formula till the row you want. =A1 & IF(A1="","",COUNTIF($A$1:A1,A1))
Using INDEX & MATCH or VLOOKUP twice and returning a third column
I have tried all day long but unfortunately I am unable to come up with the correct formula. My columns have the respective information. COLUMN A - season_id COLUMN B - team_id COLUMN C - (this is where I intend to write up the formula) I have a separate table that contains 'games played' details. In this table, the columns contain the respective. COLUMN E - match_id COLUMN F - season_id COLUMN J - team_id Please note, the 'games played' table has many repeating instances, like a team playing 10 times or more, but for the first table there are no repeating instances. I want to insert my formula in the first table (COLUMN C) such that, if value of cell A1 matches COLUMN F AND value of cell B1 matches COLUMN J, then return the first occurrence from COLUMN E. I have tried using the below formula but with no luck. It displays results but they are not accurate and some display errors. My list is quite large. =INDEX(E:E,IFERROR(MATCH(A1,F:F,0),MATCH(B1,J:J,0))) Thank you.
Use this one: =INDEX(E:E,MATCH(A1 & "|" & B2,F:F & "|" & J:J,0)) and press CTRL+SHIFT+ENTER to evaluate it
Count the number of occurences in an Excel data range
My problem is that I am trying to count the number of sub-categories of column A in column B in excel but not sure how. For example, I want to get the number 2 for category a (a1 & a2), number 5 for category b (b1 & b2 & b3 & b4 & b5) and number 1 for category c (c1).
Here is one method to accomplish what you are looking to do: **Make sure that there is a blank line above your first row of data (your first "a" and "a1" will need to start in row 2) to keep this simple and make this example work. Once your data has been shifted per the above, enter this in cell C2 and copy it down as far as your data goes: =IF(IFERROR(MATCH(B2,B$1:B1,0),"unique")<>"unique","","unique") Then, to sum the number of distinct categories, enter the following wherever you like: =COUNTIFS(A:A,"a",C:C,"unique") =COUNTIFS(A:A,"b",C:C,"unique") =COUNTIFS(A:A,"c",C:C,"unique") This can be expanded as needed. Cheers.
Excel: search if a specific text exists in a column
I have two columns. Each cell in column A contains a full sentences and each cell in column B contains a word or phrase. I would like to check if the contents of each cell in column B appears in one of the cells in column A---it could appear in multiple cells in column A or in no cells. The output just needs to be a yes or no (and should be spit out in column C) for my purposes, but it would be neat to return the number of times each column B word came up somewhere in Column A. So far I haven't figured out how to take a discrete string of letters (already printed in one cell) and search across a range in a column. Not sure if this is beyond the regular excel functionality. Thanks very much for your help!
Use array formula like this: =SUM(IF(ISERROR(SEARCH(B1,A:A,1)),0,1)) enter in formula bar then press CTRL+SHIFT+ENTER. Hope this helps. Put formula in C.
Try This : =countif(a:a,"*" & b2 & "*")>0 gives you result in True/Flase To get the occurrence =countif(a:a,"*" & b2 & "*") To get YES/NO =if(countif(a:a,"*" & b2 & "*")>0,"YES","NO")