+ Reply to Thread
Results 1 to 4 of 4

Convert Logical Formula to VBA

  1. #1
    Forum Contributor
    Join Date
    01-14-2020
    Location
    Pakistan
    MS-Off Ver
    15
    Posts
    123

    Convert Logical Formula to VBA

    Hi everyone,

    I wonder if someone could help me to convert the following formula into VBA as I'm not very good with VBA so need some help from you.

    Please Login or Register  to view this content.
    Thank you

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,022

    Re: Convert Logical Formula to VBA

    An easy way is just to do this (all examples for just the first formula)
    Please Login or Register  to view this content.
    In straight VBA code, that would be

    Please Login or Register  to view this content.

    IF you want to put that formula into a number of cells, then use

    Please Login or Register  to view this content.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Forum Contributor
    Join Date
    01-14-2020
    Location
    Pakistan
    MS-Off Ver
    15
    Posts
    123

    Re: Convert Logical Formula to VBA

    Hi Bernie,

    Thank you for your response.

    It's coming up as message box but I want the result in a cell C11 onwards. I have attached a spreadsheet here with example, which hopefully make sense.

    You will notice that there is currently a formula but that only works for "X" however I want to generalised it to "Y" & "Z". - So if you select X in Column F - it will add 20% of the total to that cell and reduce every other cell to keep the same total. I want the same for "Y" but add 10% and for "Z" keep it what it is and no change. I tried it with formula but unfortunately I couldn't crack it therefore I thought doing through VBA will be much easier.

    Really appreciate your guidance.

    Many thanks,
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,022

    Re: Convert Logical Formula to VBA

    There really is no difference between using formulas in a worksheet, and doing the same with VBA. You just need to explain what you want, so re-do your example workbook, and duplicate that sheet a few times, and show what you want with one X, two Xs, three X's Then the same for Y, and then for Z and what you want for mixed X, Y, and Z values. And use other cells to explain your logic - just type the explanation into cells where appropriate.
    Last edited by Bernie Deitrick; 04-21-2020 at 08:56 PM.

+ 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. convert value stored as text to logical refrence value!
    By Remote Desktop Connection hotkey in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 06:05 PM
  2. [SOLVED] convert value stored as text to logical refrence value!
    By Remote Desktop Connection hotkey in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 PM
  3. convert value stored as text to logical refrence value!
    By Remote Desktop Connection hotkey in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 PM
  4. convert value stored as text to logical refrence value!
    By Remote Desktop Connection hotkey in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 10:05 AM
  5. convert value stored as text to logical refrence value!
    By Remote Desktop Connection hotkey in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM
  6. [SOLVED] convert value stored as text to logical refrence value!
    By Remote Desktop Connection hotkey in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 02:05 AM
  7. convert value stored as text to logical refrence value!
    By Remote Desktop Connection hotkey in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 AM
  8. [SOLVED] convert value stored as text to logical refrence value!
    By Remote Desktop Connection hotkey in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-01-2005, 09:05 AM

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