+ Reply to Thread
Results 1 to 5 of 5

Show if there are two adjacent cells with specific values

  1. #1
    Registered User
    Join Date
    12-31-2012
    Location
    Poland
    MS-Off Ver
    2016
    Posts
    58

    Show if there are two adjacent cells with specific values

    I am working on a file and decided that I need to show in a specific cell (let's say, G10) if there are two adjacent cells in a row in columns D and E that have specific values, e.g. "Text1" in col. D and "Text2" in col. E. The code should show a message like "Cells detected" in G10 if that situation occurs. How do I set up such a code?

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool


    Very unclear but as a beginner starter :

    PHP Code: 
        If Join(Application.Index([D10:E10].Value210)) = "Text1 Text2" Then MsgBox "Detected in row #10"vbInformation 
    Do you like it ? So thanks to click on bottom left star icon « Add Reputation » !

  3. #3
    Registered User
    Join Date
    12-31-2012
    Location
    Poland
    MS-Off Ver
    2016
    Posts
    58

    Re: Show if there are two adjacent cells with specific values

    Sorry, not sure how to apply that code? The attached is an example of what I want to do - if there are any adjacent cells in the same row in columns A and B containing "Text1" and "Text2" (row 4 in the file), then there should be a message in cell C1 saying "Values found".
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Show if there are two adjacent cells with specific values


    Ok in fact for this no needs any code but just an Excel basics : a SUMPRODUCT worksheet formula …

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,996

    Re: Show if there are two adjacent cells with specific values

    Maybe:

    =IF(SUMPRODUCT(($A$2:$A$5="Text1")*($B$2:$B$5="Text2"))>0,"Values Found","")
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

+ 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. Alert while saving the file if there are two adjacent cells with specific values
    By buhaj47 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-09-2018, 09:17 AM
  2. [SOLVED] Conditional formatting based on sum of adjacent cells values and specific data
    By joey1 in forum Excel - New Users/Basics
    Replies: 13
    Last Post: 11-14-2017, 06:53 PM
  3. Copy values from adjacent cells to groups of adjacent cells with gaps
    By Kneigum in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-08-2017, 04:50 PM
  4. Replies: 13
    Last Post: 04-30-2015, 05:58 PM
  5. [SOLVED] Counting Specific Text Occurences in Cells Adjacent to Particular Values
    By lowlybroker in forum Excel General
    Replies: 7
    Last Post: 10-21-2013, 12:07 PM
  6. Replies: 7
    Last Post: 12-04-2012, 06:23 AM
  7. How can I split values over adjacent cells to show the effect of duration.
    By Jim ' in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-31-2010, 04:50 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