+ Reply to Thread
Results 1 to 7 of 7

IF Cells in a row Contains..

  1. #1
    Registered User
    Join Date
    07-09-2013
    Location
    Poland
    MS-Off Ver
    excel 2007
    Posts
    85

    IF Cells in a row Contains..

    Hi,
    could you help me with the formula to:

    1) find in a certain column some of text f.e (like in attachment) - Brazil and in a different column put America.

    There are a lot of countries and data and i want to have it sorted by continents. Macro should look at what text is in a row and change it by the specified rule till the end of rows

    Thx
    Attached Files Attached Files
    Last edited by mumsys; 07-18-2013 at 03:14 AM.

  2. #2
    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
    48,509

    Re: IF Cells in a row Contains..

    You would use VLOOKUP for that but it isn't obvious which cell has the Country lookup data and which cell has the Continent returned.

    But, something like:

    =IFERROR(VLOOKUP(A1, $B$4:$C$12, 2, FALSE),"")

    ... where cell A1 has the Country name.

    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


  3. #3
    Registered User
    Join Date
    07-09-2013
    Location
    Poland
    MS-Off Ver
    excel 2007
    Posts
    85

    Re: IF Cells in a row Contains..

    Oh ok thx, but there is a problem, and maybe i wasnt clear enough sory

    I have a column with countries in a file that was imported as an excel file. I dont have a specified column with the continents and im not intending to do this. It should run something like
    If Cell(x,1) is Brazil then put "america"
    If Cell(x,1) is Germany then put "europe"
    and until the row in this column is empty

    I have like ten countries on which i want to do this. Maybe theres a faster way to do this? But im trying to put this thing inside bigger macro

  4. #4
    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
    48,509

    Re: IF Cells in a row Contains..

    Please post a sample workbook with an accurate representation of your data and the code that you already have.

    You could use VLOOKUP within the macro.

    Regards, TMS

  5. #5
    Registered User
    Join Date
    07-09-2013
    Location
    Poland
    MS-Off Ver
    excel 2007
    Posts
    85

    Re: IF Cells in a row Contains..

    That looks like this
    Attached Files Attached Files

  6. #6
    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
    48,509

    Re: IF Cells in a row Contains..

    OK, assuming the country/continent lookup table is on a sheet named "Continents", the code would look something like this:

    Please Login or Register  to view this content.

    See the attached updated sample workbook.

    Regards, TMS
    Attached Files Attached Files
    Last edited by TMS; 07-18-2013 at 04:24 AM.

  7. #7
    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
    48,509

    Re: IF Cells in a row Contains..

    Thanks for the rep.

+ 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. combining many cells in one cells keeping character font and hyperlinks of all cells
    By mankind00 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-27-2012, 09:41 AM
  2. Replies: 4
    Last Post: 06-17-2011, 08:53 AM
  3. Formula: Drop Down List -> Choose Option Finds Cells & Replace Cells with Cells
    By g00glethis1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-14-2010, 01:10 PM
  4. Replies: 2
    Last Post: 06-24-2010, 04:53 PM
  5. Replies: 0
    Last Post: 09-06-2005, 10:05 AM

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