+ Reply to Thread
Results 1 to 6 of 6

Help refining a formula - not sure if it needs to VBA or not.

  1. #1
    Registered User
    Join Date
    12-30-2013
    Location
    Elgin
    MS-Off Ver
    Excel 2013
    Posts
    52

    Help refining a formula - not sure if it needs to VBA or not.

    Hey guys,

    Back again.

    I wanted to try and refine this formula, because it works, but can produce errors pretty easily.

    I have two lists of data. Column A can have multiple values in a cell. Column B will have lots of matching values in Column A, but only one value per cell.

    This is my helper formula. I put this in column E. I need to hit ctrl+shift+enter.
    Please Login or Register  to view this content.
    Then I also use this formula in column C. Also ctrl+shift+enter.
    Please Login or Register  to view this content.
    What they do in combination is number the values in column B based on when they are seen in Column A.

    The only problem with this is it looks for ANY matching case. You will see in my example that D1 (column B, row 33) is seen as the same as FD1 (column A, row 12). The same is true for R1 (column B row 48) being seen the same as VR1 (column A, row 36).
    How can I make this so it searches for EXACT cases only? So far my workaround has been to scan the list for data that might be similar and replace it with a different name (FD1 -> FN1) Unfortunately I easily miss stuff when I do that.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: Help refining a formula - not sure if it needs to VBA or not.

    Maybe add a preceding space? Changing the formula in E2 to:

    {=MAX(ISNUMBER(SEARCH(" "&B2&","," "&$A$2:$A$84))*ROW($A$2:$A$84))}

    seems to fix your false positives?

  3. #3
    Registered User
    Join Date
    12-30-2013
    Location
    Elgin
    MS-Off Ver
    Excel 2013
    Posts
    52

    Re: Help refining a formula - not sure if it needs to VBA or not.

    Hmm...Ya that seems to work.

    So is that saying that _R1, does not equal _VR1?

    But R1, does equal VR1, ???

  4. #4
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: Help refining a formula - not sure if it needs to VBA or not.

    Pretty much. The original formula returns a match for any occurrence of "R1," regardless of what is immediately before or after, so things like "VR1," count, as would something like "R1,X". The new version looks specifically for a space followed by R1, so it won't return a match unless it sees " R1,". Given that your data in column A precedes every entry with a space and follows it with a comma, this should be a safe way to look for matches.

  5. #5
    Registered User
    Join Date
    12-30-2013
    Location
    Elgin
    MS-Off Ver
    Excel 2013
    Posts
    52

    Re: Help refining a formula - not sure if it needs to VBA or not.

    Gotcha, makes sense. I guess I was a little thrown off because there are actually no blank spaces before any of the first entries in column A.
    Thanks!

  6. #6
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: Help refining a formula - not sure if it needs to VBA or not.

    Quote Originally Posted by Jveto View Post
    there are actually no blank spaces before any of the first entries in column A.
    You're absolutely right, but changing the range portion of the SEARCH from $A$2:$A$84 to " "&$A$2:$A$84 addressed that concern. For the purposes of the SEARCH, we put a space in front of each entry in A, so the formula will still work on the first term in each cell in A.

    Good luck!

+ 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] Modifying n Refining VBA
    By dineshsachidananda in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-07-2015, 02:56 PM
  2. Refining Price Lists
    By VFSFINANCE in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-16-2014, 11:06 AM
  3. Refining VBA Code
    By johannes2008 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-21-2011, 08:37 PM
  4. Refining a Find Statement
    By Jordan Kidd in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-02-2010, 08:06 AM
  5. Formula refining
    By jackandjill in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-23-2010, 08:32 AM
  6. Refining Countif
    By asg2307 in forum Excel General
    Replies: 5
    Last Post: 02-14-2006, 03: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