IF "x" is within all columns


Active Member
I'm looking for a formula to put in 100 rows to tell me if "exclude" is populated in any of the 250 columns. If yes, then "exclude included" If no, then "Exclude not included" Any ideas?


MrExcel MVP, Junior Admin
Use a COUNTIF function to count the number of times it occurs. You just want to see if there is at least one there, i.e.
=IF(COUNTIF(range to check,"exclude")>0,"exclude included","exclude not included")

Just substitute the range you are checking into the formula.


MrExcel MVP
=IF(COUNTIF(column range,"*exclude*")>0,"exclude included","exclude not included")
where column range would be something like B1:XFD1 ...


Active Member
I see you have COUNTIF covered so I'll go with MATCH.

The A2 to A6 formula looks for "exclude" by itself.
The A7 to A101 formula includes "exclude" as a part of any string.

1Col 1Col 2Col 3Col 4Col 5Col 6
2Exclude not includedandtowhichandforof
3exclude includedexcludesoundlygivetprotestationofof
4Exclude not includedthebetterifirst that tis ask exclude better thetisthat
5Exclude not includedtellmanpoorbodyIwere
6exclude includeddemandnightsflyrenderherefordlazar
7Exclude not includedthoughmeancannotandthewell
8exclude includedtominglebidfirst that tis ask exclude better thebeking
9Exclude not includediwilltoshalllikewiseto
10Exclude not includedfordesireandwithdefuncttides
11exclude includedtakedevilbidstarvingobjectsexclude
12exclude includedtheshaltgonegreyandExclude

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col></colgroup><thead>

Worksheet Formulas
A2 to A6
=IF(ISNA(MATCH("exclude",B2:IR2,0)),"Exclude not included","exclude included")
to A101
=IF(ISNA(MATCH("*exclude*",B7:IR7,0)),"Exclude not included","exclude included")



P.S. Test data from my random extract of 100,000 words from Shakespeares plays, which apparently did not include "exclude" until I made it so.

Some videos you may like

This Week's Hot Topics

  • Importing multiple excel files into one spreadsheet
    Hi, I'm trying to import multiple excel files (with the same format into a single spreadsheet) so that each day's file is listed underneath the...
  • find many based on a certain criteria
    good evening, I hope someone can help me? I have a workbook sheet 2 contains lots of data.... I would like to be able to find anything on sheet...
  • How to copy multiple rows using If
    Hi all, I'm very new to VBA and have written this simple code to copy certain cells if a certain cell within that row contains any data. I need...
  • VBA If statement
    Dear All, I have two dates, where I'd like a message box to pop, if the dates are between this criteria. [CODE] sDate1 = #10/1/2019#...
  • Text Format
    I have a sheet for user to keyin the data. The format of the data can be 451 / 1903, 0012 / 9908 or 00287 / 0099. The number after the "/" is...
  • Macro to copy values across rows and transposing them and add the user id
    [FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][FONT=Calibri][SIZE=3][COLOR=#000000]Hi,[/COLOR][/SIZE][/FONT] [FONT=Times New...