+ Reply to Thread
Results 1 to 13 of 13

If a value is contained in a column...

  1. #1
    Registered User
    Join Date
    07-30-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    36

    If a value is contained in a column...

    I was wondering if it is easily possible to achieve the following:

    Table1, which is made of the columns A,B & C (Time, ID #, and blank, respectively).
    Table2, which is made of the columns A & B (Time and Type, respectively).

    Is there a way for me to check to see if Table1[A] is equal to any value in Table2[A] and then for the corresponding 'Type' (Table2[B]) to be displayed in Table1[C] if there is a corresponding value.

    Sorry if this is a little vague, let me know if I need to clarify.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: If a value is contained in a column...

    Hard to be precise without seeing a sample of what you are working with, but take a look at using the vlookup() or index/match functions.

    If you still have a problem, upload a small (clean) sample of what you are working with, and what your expected outcome would look like.
    Last edited by FDibbins; 08-07-2014 at 05:20 PM.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,463

    Re: If a value is contained in a column...

    Sounds as though you're looking for VLOOKUP.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Valued Forum Contributor
    Join Date
    05-13-2010
    Location
    Belo Horizonte, Brazil
    MS-Off Ver
    Excel 2003; 2007
    Posts
    441

    Re: If a value is contained in a column...

    mtma, Good evening.

    Scenario:

    Table1
    A1:C1

    Table2
    A1:B10

    Search:
    Table1 --> C1
    =IFERROR(VLOOKUP(A1,Table2!$A$1:$B$10,2,0),"")

    Is it what you want?
    I hope it helps.
    ...If my answer helped you, Please, click on. * Add Reputation (at left)

    Best regards.
    Marc?lio Lob?o

  5. #5
    Registered User
    Join Date
    07-30-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    36

    Re: If a value is contained in a column...

    I'm not sure exactly what that does, I'll look into VLOOKUP in a moment. Meanwhile, I have attached a basic spreadsheet scenario.

    In this scenario, ideally, if a time in the first table matches a time in the second table AND is type "G", then a "G" is entered into the "Other" column of table 1.
    Book1.xlsx

  6. #6
    Valued Forum Contributor
    Join Date
    05-13-2010
    Location
    Belo Horizonte, Brazil
    MS-Off Ver
    Excel 2003; 2007
    Posts
    441

    Re: If a value is contained in a column...

    mtma, Good evening.

    Take a look at it:
    Book1-ok.xlsx

    Is it what you want?
    I hope it helps.

  7. #7
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: If a value is contained in a column...

    Mazzaropi, that does not consider that column F needs to contain G, and also, look at C5. That is for 9:30 AM, and E10 is also 9:30 with a G, but the vlookup does not cath that match

    Try this, copied down...
    =IF(SUMPRODUCT(--(ROUND(Sheet1!$E$2:$E$20,6)=ROUND(Sheet1!$A2,6))*--($F$2:$F$20="G"))=1,"G","")

  8. #8
    Registered User
    Join Date
    07-30-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    36

    Re: If a value is contained in a column...

    Thank you both!! Very Helpful!

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: If a value is contained in a column...

    Happy to help and thanks for the feedback

    With the suggested vlookup though, check the 9:30 values, it does not catch that

  10. #10
    Registered User
    Join Date
    07-30-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    36

    Re: If a value is contained in a column...

    Coooool Thank you again!

  11. #11
    Registered User
    Join Date
    07-30-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    36

    Re: If a value is contained in a column...

    I ended up modifying it like this to match my actual sheet:
    =IFERROR(VLOOKUP([@Time],HistoryData,6,TRUE),"")

    Could anyone tell me where I went wrong?

  12. #12
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,463

    Re: If a value is contained in a column...

    If you are looking for an exact match, the fourth parameter for the VLOOKUP function should be FALSE, not TRUE.

    Regards, TMS

  13. #13
    Registered User
    Join Date
    07-30-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    36

    Re: If a value is contained in a column...

    I have tried both, but neither is working.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] SUMPRODUCT IF COLUMN B=x AND COLUMN E CONTAINED IN A LIST
    By AL1976 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-17-2014, 10:35 AM
  2. Count of Dates Contained in an Entire Column
    By gpzbc in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-03-2013, 02:54 PM
  3. [SOLVED] IF/THEN column heading contained in row, 1 if true, 0 if false
    By sydney72 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 01-20-2013, 11:38 PM
  4. Replies: 1
    Last Post: 04-15-2012, 06:20 PM
  5. Replies: 4
    Last Post: 04-10-2011, 08:56 PM

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