Posts by pulsar777

    Re: Function with variable number of conditions

    Quote from xladept;761212

    Hi Pulsar,

    How do you intend to invoke this function? (I think it should be a sub by the way):)

    Hi xladept, I think I'll have a sub that checks data table for column called category, then it creates the column or/and just populates it by the function or possibly an SQL query.

    Re: Function with variable number of conditions

    Quote from cytop;761211

    I'm not sure I'd like to try and code that as a function - too many twists and turns... my opinion only, I'll stress.

    Without comments in the message, an alternative approach in the attached copy of your workbook - the code is commented to describe what it's doing. It would be easy enough to extend this to include comparisons like <, <=, >, >=, Not Equal and any other combinations you can think of. At the moment, it only works with String data, Numbers, Dates and Boolean can be added easily.

    One caveat - the workbook must be saved or else new (unsaved) data will not be found but it's just a matter of a quick click on save before running...

    Hi Cytop, some really impressive tip I must say. I will slighly modify the code and try it out a bit later, since I have no experience with ADODB on excel itself yet.
    But really appreciated. Thanks much !

    Hi folks!
    I'd like to create a function that would take criteria from Lookup_ref sheet and return a category name on Data sheet, column H. Something like:

    Custom categories would be created from populated fields and would take into account the operator equals, contains .. right below the header.
    I thoght of making UDF worksheetfunction, where loop creates a string of nested IFs for each row combination but I'd probably hit the nesting limit. On the other hand,
    I am not sure how to create a VBA IF statement of variable lenght.