+ Reply to Thread
Results 1 to 10 of 10

IF/THEN column heading contained in row, 1 if true, 0 if false

  1. #1
    Registered User
    Join Date
    01-17-2013
    Location
    canada
    MS-Off Ver
    Excel 2003
    Posts
    3

    IF/THEN column heading contained in row, 1 if true, 0 if false

    hi everyone,
    so i have a series of columns. in one of the columns, each row contains a number of phrases separated by commas that are also column headings. what i want to do is if the column heading is contained in the row of column a, then 1, if not, then 0.
    so I have =IF(A2=B1,1,0) then =IF(A2=C1,1,0) etc. i think i need to put the actual phrases in quotes to draw out of the row and compare to the column heading?

  2. #2
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: IF/THEN column heading contained in row, 1 if true, 0 if false

    A sample workbook seems a definite must on this....without seeing the info, not sure how to find what you are looking for..

    Add a File - click advanced (next to quick post), scroll down until you see "manage attachments", click that and select "add files" (top right corner). click "select files", find your file, select file, click "upload", when the file shows up at the bottom left click 'done"(bottom right). click "submit reply"(remember the 1 MB limit, you may have to crop your file down to get it to a size that can be uploaded...)
    A picture may be worth a thousand words, BUT, a sample Workbook is worth a thousand screenshots!
    -Add a File - click advanced (next to quick post), scroll to manage attachments, click, select add files, click select files, select file, click upload, when file shows up at bottom left, click done (bottom right), click submit
    -To mark thread Solved- go top of thread,click Thread Tools,click Mark as Solved
    If you received helpful response, please remember to hit the * of that post

  3. #3
    Registered User
    Join Date
    01-17-2013
    Location
    canada
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: IF/THEN column heading contained in row, 1 if true, 0 if false

    i thought so ...here you go ...so i want to return a value of 1 if true and 0 if false in corresponding column if contents of rows a2:a13 match any heading
    Attached Files Attached Files

  4. #4
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: IF/THEN column heading contained in row, 1 if true, 0 if false

    In B2 cell
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Drag it down and right...........


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  5. #5
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: IF/THEN column heading contained in row, 1 if true, 0 if false

    Try in B2
    =IF(ISERROR(IF(B$1="",FALSE,SEARCH(B$1,$A2)>0)),FALSE,IF(B$1="",FALSE,SEARCH(B$1,$A2)>0))
    or for 2007 +:
    =IFERROR(IF(B$1="",FALSE,SEARCH(B$1,$A2)>0),FALSE)

    Hope this helps

  6. #6
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: IF/THEN column heading contained in row, 1 if true, 0 if false

    darn...I went wrong way...:
    =IF(ISERROR(IF(B$1="",0,SEARCH(B$1,$A2)>0)),0,IF(B$1="",0,SEARCH(B$1,$A2)>0))*1
    =IFERROR(IF(B$1="",0,SEARCH(B$1,$A2)>0),0)*1

    Edit-
    first formula can be shortened to this :
    =IF(ISERROR(SEARCH(B$1,$A2)>0),0,IF(B$1="",0,SEARCH(B$1,$A2)>0))*1

    and forgot to mention---
    Drag down and across
    Last edited by dredwolf; 01-18-2013 at 01:10 AM.

  7. #7
    Forum Contributor
    Join Date
    12-23-2003
    Posts
    179

    Re: IF/THEN column heading contained in row, 1 if true, 0 if false

    Quote Originally Posted by sydney72 View Post
    [...]
    B2, copied down:

    =ISNUMBER(LOOKUP(9.99999999999999E+307,SEARCH($B$1:$O$1,A2),$B$1:$O$1))+0

  8. #8
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: IF/THEN column heading contained in row, 1 if true, 0 if false

    You could also use FIND instead of SEARCH, but FIND is case sensitive (ie- "finish" does NOT = "Finish" with FIND, but it DOES with SEARCH)

  9. #9
    Registered User
    Join Date
    01-17-2013
    Location
    canada
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: IF/THEN column heading contained in row, 1 if true, 0 if false

    thank you all! dredwolf, worked beautifully!

  10. #10
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: IF/THEN column heading contained in row, 1 if true, 0 if false

    You are welcome

    Please remember to mark the thread as solved if you are satisfied with your solution :
    To mark thread "Solved", go to the top of the thread,click "Thread Tools",click "Mark as Solved"

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1