+ Reply to Thread
Results 1 to 8 of 8

Wildcard operator for numbers?

  1. #1
    Registered User
    Join Date
    08-17-2013
    Location
    Tunbridge Wells, UK
    MS-Off Ver
    Excel 2010
    Posts
    4

    Wildcard operator for numbers?

    Is there such a thing as a wildcard operator for numbers (ie. "return a result if a cell has a number greater than zero")?

    I'm using a user-defined function I cribbed off the 'net called "LOOKUP_CONCAT" which basically searches a column (let's say column B) and compares whether or not it contains a certain parameter, then searches the corresponding rows in another column (say, column A) for a text string, then concatenates the resulting cell contents into a single cell. The function actually looks like this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    This would search for all the cells in column B that contained just the letter Y, then look up and dump the contents of every cell in a corresponding row from column A into the cell containing the formula. Which is fantastic if you're using a particular letter or even a particular number, but I'm now looking for a way to return the contents of a row that contains any number (a 10, a 7 or whatever, other than a blank) in column B.

    Surely there's a wildcard character I can use to replace the "Y" in the above formula to check if there's a number present in a cell which is greater than zero...? I've tried:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    ...and so on, but the only permutation that works is entering specific numbers, which only returns the rows relating to that particular number. I've tried looking through endless forums and the MS Excel help but all it keeps throwing up are text wildcard operators. I need the number values intact as I'm keeping running totals at the foot of each column for other purposes, so changing the values to text isn't an option.

    Wildcard Needed.xlsx

  2. #2
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Wildcard operator for numbers?

    Hello kdisley,

    Welcome to the Forum.

    Your workbook contains no VBA to see what your Code looks like, so I was wondering if the attached sample workbook will work for you?

    Also see the "Please consider" note at the bottom of this post.
    Attached Files Attached Files
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  3. #3
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Wildcard operator for numbers?

    Use the UDF here:

    http://www.excelforum.com/showthread...=1#post3096647

    Then, enter this array formula**:

    =concatall(IF(B2:B53>0,A2:A53,""),", ")

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Registered User
    Join Date
    08-17-2013
    Location
    Tunbridge Wells, UK
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Wildcard operator for numbers?

    Sorry, I think I've possibly confused everyone with my previous ham-fisted explanation...! After much trial-and-error (I've never used VB at all before, except for that one cut-and-paste for the UDF I'm using which explained in idiot language how to get it running, so I'm still trying to figure it all out), I've created a better example that should illustrate more clearly what I'm on about: Wildcard Needed (Better Explanation).xlsm

    The second sheet shows a working instance of LOOKUP_CONCAT so that you can see that searching for "Y" works as the first value (in this case, the context is "has this character met this particular NPC in the course of a game?"), and on the first sheet I've added a text representation of the results I'm trying to get to in red, highlighted in yellow. I've also managed to upload a VB-enabled worksheet this time, so the formula actually works!

    Like I say, the problem I've got here is finding a substitute for "Y" so that it'll return a concatenated entry of what each player has spent their experience points on (regardless of what the actual number value of points spent is), so that I'll be able to see at-a-glance what each player has bought in a single cell and re-display that cell in the players' individual reference sheets with a simple "show cell contents". That way I can have a growing list as they buy more stuff just by entering it into the table and having it update itself as we progress (as with the NPC sheet I used as an example, which gets copied to each player's sheet individually).

    The reason for the number totals at the bottom, by the way, is to again be copied to the players' sheets to be subtracted from their total points earned so that I can also keep a track of how many they have left (hence the values have to stay as numbers). I actually have about 14 separate sheets in all, some collating and some displaying various data about the game's progress, the idea being I can keep a few sheets open with sensitive information for entries then hide them to show the stats I want the players to see at the end of a session.

    It looks to me like I need a numerical wildcard or a >0 to return a TRUE response for any non-blank cell in the column regardless of the actual number value, but Excel just doesn't seem to want to accept anything but an exact number as the logical argument... it seems like I'm missing some fundamental logic here and I'm sure it's staring me in the face, but I'm stumped.

    EDIT: Also, the way that LOOKUP_CONCAT was constructed puts the comma at the start rather than the end of each result, resulting in the weird output... if anyone knows how to swap that around so that it's at the front (so that Player 1's entry would be "Potence 1, Potence 2, ") then that would be a fantastic bonus, but is by no means essential.
    Last edited by kdisley; 08-18-2013 at 12:51 PM.

  5. #5
    Registered User
    Join Date
    08-17-2013
    Location
    Tunbridge Wells, UK
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Wildcard operator for numbers?

    Oh, and thanks for the welcome Winon, it was appreciated!

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Wildcard operator for numbers?

    I kind of got lost in your explanation...

    It may be that your UDF doesn't accept that type of argument. I didn't download your updated file to look at the code. I'm not much of a programmer.

    The link I posted has a very good concatenation UDF. I've tried a few over the years and I think the one I linked to is the easiest to implement.

  7. #7
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Wildcard operator for numbers?

    Try this UDF
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    I have put two examples of how it can be used in your workbook

    In J34, and then manually changed to suit each player
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    In K34, drag/fill down
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Don't use merged cells, they are a pain in the ***, and will give you nothing but grief ...
    Attached Files Attached Files
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  8. #8
    Registered User
    Join Date
    08-17-2013
    Location
    Tunbridge Wells, UK
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Wildcard operator for numbers?

    Exactly what I was looking for, Marcol... one of these days I'll learn some VB myself, but until then it remains some form of mystical art to someone who's training to work with cables rather than code - and you have proven yourself to be some kind of magician!!!

    Many thanks to all that posted replies, and I apologise that I made my explanations perhaps a bit too verbose - at the time it all seemed relevant, but I appreciate that you probably didn't want or need to know all the ins and outs of my game statistics!

    Once again, thanks to Marcol and everyone else who has helped me with this problem.

+ 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] Find: Using wildcard, but don't replace with wildcard
    By JimDandy in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-06-2013, 05:39 PM
  2. [SOLVED] [SOLVED] Macro/Wildcard to remove only numbers excluding text with numbers
    By indianhp in forum Word Programming / VBA / Macros
    Replies: 6
    Last Post: 06-21-2013, 08:16 AM
  3. Replies: 4
    Last Post: 04-02-2012, 01:19 AM
  4. Excel 2007 : Using If Statements with a wildcard operator
    By ronbailey in forum Excel General
    Replies: 1
    Last Post: 08-23-2011, 12:39 PM
  5. Replies: 4
    Last Post: 12-14-2009, 03:21 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