+ Reply to Thread
Results 1 to 6 of 6

Comparing characters

  1. #1
    Forum Contributor
    Join Date
    10-08-2010
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    386

    Comparing characters

    I am going to try and explain this as best I can.

    I have 9 values i need to compare. They each contain a string of numbers from 1-9. So 123, 1234, 1345, 14689 and so on. They will never contain more of the same number, and will always be from lowest to highest. I need to compare value one to the other values, then value 2 against the other values, then value 3 and 4 all the way to 9. there will be 9 total. I need it to count how many of each character from a certain value, can be found in each of the other values.

    So far I think i have the logic down, but I don't know an efficient way to code it.

    Compare 257 against 35678

    They both have a 5, and a 7. This is a match.

  2. #2
    Forum Contributor
    Join Date
    10-08-2010
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    386

    Re: Comparing characters

    Maybe I can clarify, let's say we have 9 values. The first value we look at is 123. i want to check the other 8 values and see if they contain 1 and 2 or 1 and 3 or 2 and 3.

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Comparing characters

    Confirmed with Ctrl+Shift+Enter:

    =SUM(--(MID(A1, ROW(INDIRECT("1:" & LEN(A1))), 1) = TRANSPOSE(MID(B1, ROW(INDIRECT("1:" & LEN(B1))), 1))))
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Forum Contributor
    Join Date
    10-08-2010
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    386

    Re: Comparing characters

    Sorry i need this done in VBA, i don't want any helper cells. Excel is only being used as a GUI

  5. #5
    Forum Contributor
    Join Date
    10-08-2010
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    386

    Re: Comparing characters

    The issues i don't know what function to use. I need it to count each possible 2 digit number in each other cell.

    it will always be 9 cells total. cell 1 has 123456789.... i want it to count 12, 13, 14, 15, 16, 17, 18, 19, 23, 24 ,25, 26, 27, 28, 29,34,35,36,37,38,39,45,46,47,48,49,56,57,58,59,67,68,69,78,79,89

  6. #6
    Forum Contributor
    Join Date
    10-08-2010
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    386

    Re: Comparing characters

    so really i need to know how to get it to loop for each possible combination and return the total amount of that number in a range

+ 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