+ Reply to Thread
Results 1 to 6 of 6

User Defined Function - Adjustment (IF/AND?)

  1. #1
    Valued Forum Contributor
    Join Date
    04-21-2005
    Location
    Southern England
    MS-Off Ver
    Excel for Office 365
    Posts
    1,702

    User Defined Function - Adjustment (IF/AND?)

    Hi,

    I have the following extract from a UDF:

    Please Login or Register  to view this content.
    Which Looks in a cell and if it contains these words (pyrodur or pyrostop) then class it as "Fire"

    However I need to break this down a further level to:
    If it contains (Pyrodur and CS) or (Pyrostop and CS) then its "Fire CS"
    If it contains (Pyrodur and Stock) or (Pyrostop and Stock) then its "Fire Stock"

    The field to look in would be displayed like this:
    Pyrostop EI30-10 15mm CS -----------The result would need to be displayed as "Fire CS"
    Pyrodur EW30-201 10mm CS -----------The result would need to be displayed as "Fire CS"
    Pyrostop EI30-10 15mm Stock -----------The result would need to be displayed as "Fire Stock"
    Pyrodur EW30-201 10mm Stock -----------The result would need to be displayed as "Fire Stock"

    Importantly I can not get it to search just "CS" or "Stock" as there are other non fire products that fall into this.

    Can an AND function be added to the code above e.g. Like *Pyrostop* AND *CS* but both must be present (not just pyrostop or CS)

    Any suggestions?

    Paul

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: User Defined Function - Adjustment (IF/AND?)

    Maybe:

    Please Login or Register  to view this content.
    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  3. #3
    Valued Forum Contributor
    Join Date
    04-21-2005
    Location
    Southern England
    MS-Off Ver
    Excel for Office 365
    Posts
    1,702

    Re: User Defined Function - Adjustment (IF/AND?)

    thanks, this worked - just need to amend it alittle

    Sometime "Stock" is written as:
    Stock
    STOCK
    Stk

    Can the line below:
    Like "*STOCK" Then

    Be changed to include all different ways of saying "stock"?

  4. #4
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: User Defined Function - Adjustment (IF/AND?)

    Convert the case
    Please Login or Register  to view this content.
    Good luck.

  5. #5
    Valued Forum Contributor
    Join Date
    04-21-2005
    Location
    Southern England
    MS-Off Ver
    Excel for Office 365
    Posts
    1,702

    Re: User Defined Function - Adjustment (IF/AND?)

    Hi,

    Sorry i wasnt clear. Our database for the various products displays stock as either: STOCK, Stock, Stk so ideally i would like one code that will take all three into consideration - is this possible?

  6. #6
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: User Defined Function - Adjustment (IF/AND?)

    My fault - I did not read closely enough.
    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)

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