+ Reply to Thread
Results 1 to 10 of 10

VBA formula

  1. #1
    Forum Contributor
    Join Date
    04-03-2014
    Location
    Berlin
    MS-Off Ver
    Excel 2010
    Posts
    160

    VBA formula

    Hi everybody,

    I've got the following excel formula that I am trying to integrate in a code I am currently using:

    =if(J2="GS";"VOL101";if(J2="RE";"VOL100";if(and(J2="AC";K2<0);"VOL101";if(and(J2="SA";K2<0);"VOL101";if(and(J2="RX";K2<0);"VOL101";"VOL100"))))))

    As my VBA skills are rather poor, I would really appreciate it if you could give me a hand with that.

    Thanks a lot!

    regards
    Last edited by vio.coman; 06-11-2015 at 04:10 PM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: VBA formula

    How do you want to integrate it? Do you want code that will provide the same result as this formula, or do you want to put this formula into a cell using VBA? What is the context of your existing code?
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    04-03-2014
    Location
    Berlin
    MS-Off Ver
    Excel 2010
    Posts
    160

    Re: VBA formula

    Hi jeff,

    thanks for your reply!
    Here's my code:
    Please Login or Register  to view this content.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: VBA formula

    So you want to assign the formula to a cell? Try this. by the way you had an extra parenthesis at the end of your formula above.

    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: VBA formula

    Your formula works if you put it in like this:
    Please Login or Register  to view this content.
    Sorry Jeff. You beat me to it.
    Some people volunteer in soup kitchens or hospitals. I choose to make the world better by trying to help you with Excel. We're all learning.

    <---Click * Add Reputation for all helpful comments. It's like giving a smile.
    Forum Rules: How to mark your post [Solved] and have a happier, Excel enriched life.

  6. #6
    Forum Contributor
    Join Date
    04-03-2014
    Location
    Berlin
    MS-Off Ver
    Excel 2010
    Posts
    160

    Re: VBA formula

    thanks a lot for your input!

    it works perfectly

  7. #7
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: VBA formula

    Glad you got something that worked. That syntax can be confusing when you want to put a quote into a string.

  8. #8
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: VBA formula

    A quick note on localization: If your configuration of Excel uses semicolons as separators, you have to use semicolons in VBA formula strings.

  9. #9
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: VBA formula

    You are right Jeff. I forgot to switch them back after I was done testing it.

  10. #10
    Forum Contributor
    Join Date
    04-03-2014
    Location
    Berlin
    MS-Off Ver
    Excel 2010
    Posts
    160

    Re: VBA formula

    yes, thanks!

+ 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. Replies: 11
    Last Post: 06-06-2014, 03:34 PM
  2. how to hide formula in formula box, view lookup result in formula box?
    By vengatvj in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-14-2013, 04:06 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