+ Reply to Thread
Results 1 to 3 of 3

Convert if statement to Case Function

  1. #1
    Registered User
    Join Date
    05-16-2011
    Location
    Sydney
    MS-Off Ver
    Excel 2003
    Posts
    7

    Wink Convert if statement to Case Function

    I'm trying to get the following code to work as a Case Function and can't seem to find how i would define the different ranges to test.

    My working VBA IF statement, which populates the column M cells with 410, 470, 430, and 420 depending on what is found in column L, I or A, is:

    Please Login or Register  to view this content.
    Can anyone help me convert that into a Case Function?
    Last edited by KarlSm; 05-22-2011 at 05:19 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Convert if statement to Case Function

    The Select Case method is not appropriate for your scenario. A VBA version of your IF tests, since each one is different, would be:

    Please Login or Register  to view this content.



    However, I hate looping row by row when your formula method could actually do it all in one fell swoop, I would change it to this:
    Please Login or Register  to view this content.

    This will put in the formulas, then remove them, leaving the values behind.
    Last edited by JBeaucaire; 05-21-2011 at 11:25 AM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    05-16-2011
    Location
    Sydney
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Convert if statement to Case Function

    Thanks for your help

+ 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