+ Reply to Thread
Results 1 to 17 of 17

Comparing Text of one cell to another

  1. #1
    Registered User
    Join Date
    06-11-2019
    Location
    North Carolina, United States
    MS-Off Ver
    2010
    Posts
    48

    Comparing Text of one cell to another

    I need help writing a macro that compares text in a cell to the one below it to apply formating

    something along the lines of
    Please Login or Register  to view this content.
    Last edited by Leith Ross; 06-18-2019 at 02:55 PM.

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Comparing Text of one cell to another

    Offset(row,column), so if you want below it is 1,0 not 0,1
    However, this method avoids un-necessary selects:

    Please Login or Register  to view this content.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Registered User
    Join Date
    06-11-2019
    Location
    North Carolina, United States
    MS-Off Ver
    2010
    Posts
    48

    Re: Comparing Text of one cell to another

    Would this work for a range that changed due to yes count? It's a Boolean comparison

    5 - 1
    5 - 2
    5 - 3
    5 - 4
    4 - 3
    4 - 2
    4 - 1

    etc.
    Only looking at the text in the A column?

  4. #4
    Registered User
    Join Date
    06-11-2019
    Location
    North Carolina, United States
    MS-Off Ver
    2010
    Posts
    48

    Re: Comparing Text of one cell to another

    And would there be a way to make it apply the formatting from A1:A6

    Sorry for not including all of this in my initial post.

  5. #5
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Comparing Text of one cell to another

    Attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  6. #6
    Registered User
    Join Date
    06-11-2019
    Location
    North Carolina, United States
    MS-Off Ver
    2010
    Posts
    48

    Re: Comparing Text of one cell to another

    Attachment 628751
    Attachment 628752


    It currently looks like this.
    Please Login or Register  to view this content.
    Last edited by Leith Ross; 06-18-2019 at 02:56 PM.

  7. #7
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Comparing Text of one cell to another

    Hmm... the attachments didn't work. Did you use the instructions in my previous post?

  8. #8
    Registered User
    Join Date
    06-11-2019
    Location
    North Carolina, United States
    MS-Off Ver
    2010
    Posts
    48

    Re: Comparing Text of one cell to another

    I added the attachtment

  9. #9
    Registered User
    Join Date
    06-11-2019
    Location
    North Carolina, United States
    MS-Off Ver
    2010
    Posts
    48

    Re: Comparing Text of one cell to another

    Sorry im new to this, I uploaded the attachment like you stated above, it showed in the current attachment section I closed the tab now I can't see the file I attached.

  10. #10
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Comparing Text of one cell to another

    Sorry strpurdu, I still can't find any attachments. In your private message you said something about columns to the right? Yet a post here says A1:A6 which is rows 1 to 6. I'm a bit confused that's why I wanted a file that illustrates the desired result better.

  11. #11
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Comparing Text of one cell to another

    Did you click the "choose file button", and then after picking the file, click the "upload" button?

  12. #12
    Registered User
    Join Date
    06-11-2019
    Location
    North Carolina, United States
    MS-Off Ver
    2010
    Posts
    48

    Re: Comparing Text of one cell to another

    Sorry my private message was right, It needs to format the cell itself and 8 cells to the right. So for example it'll apply formatting around A3:I3 Depending on the text in A3 and how it compares to A4. Hope that helps explain it a little. The code you sent works, I just need it to apply the same action to the 8 cells to the right of the one it's checking

  13. #13
    Registered User
    Join Date
    06-11-2019
    Location
    North Carolina, United States
    MS-Off Ver
    2010
    Posts
    48

    Re: Comparing Text of one cell to another

    Attached Test Attached Test Attached Test Attached Test Attached Test
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    06-11-2019
    Location
    North Carolina, United States
    MS-Off Ver
    2010
    Posts
    48

    Re: Comparing Text of one cell to another

    The number of Values in A can change, and sorry the text isn't the same as in before and after but you get the point right?

  15. #15
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Comparing Text of one cell to another

    Ok I see... how about this:

    Please Login or Register  to view this content.

  16. #16
    Registered User
    Join Date
    06-11-2019
    Location
    North Carolina, United States
    MS-Off Ver
    2010
    Posts
    48

    Re: Comparing Text of one cell to another

    It's good but it seems to mess up the table at the bottom, is there anyway to make it stop when cell value is empty.

    Thank you so much for all your help

  17. #17
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Comparing Text of one cell to another

    I see a bit of odd lines still near the bottom, due to conditional formatting, but code wise I believe this should do it:

    Please Login or Register  to view this content.

+ 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. Enter Specific text by comparing other cell
    By winmaxservices in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-25-2015, 02:57 PM
  2. Replies: 7
    Last Post: 01-04-2014, 10:11 PM
  3. Change text color when comparing 2 text fields
    By lisashart in forum Excel General
    Replies: 1
    Last Post: 08-20-2013, 12:22 PM
  4. Comparing the text content of a cell to another and displaying a result
    By schallpattern in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-10-2013, 04:39 PM
  5. Replies: 5
    Last Post: 04-28-2012, 01:54 AM
  6. Replies: 1
    Last Post: 02-02-2012, 09:25 AM
  7. Comparing text in two cells to create text in another
    By gareths69 in forum Excel General
    Replies: 4
    Last Post: 12-13-2011, 02:20 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