+ Reply to Thread
Results 1 to 4 of 4

VBA formula incorrect, not sure why

  1. #1
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    VBA formula incorrect, not sure why

    I am trying to modify a formula for use in VBA. The below worked great when all the values where on one sheet.

    Original:
    Please Login or Register  to view this content.
    Now the values are one 2 sheets and need to be run using VBA.

    Please Login or Register  to view this content.
    The code above produces "No" values in all the cells that get the calculations and that should not be. In the attached spreadsheet after the classify macro is run and case 1 is selected in A2, the homopolymer column is populated with values (currently "No").

    Using 43394861 (R6) should be 7G, but it is not.
    The way it should work is Q6 or 1 is searched in the desired range of panel, then 43394861 (R6) is searched in the desired range of panel. Finally a vlookup is done on R6 and the result of that is what is outputted to cell AQ6.

    Im not sure if the correct formula is being used in the VBA as it worked before. Thank you for any help.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    01-19-2012
    Location
    Barrington, IL
    MS-Off Ver
    Excel 2007/2010
    Posts
    1,211

    Re: VBA formula incorrect, not sure why

    When using formulas in VBA I've always ended up using FormulaR1C1 and modifying the formula to that format, not sure if yours is not working for the same reason but here;

    Please Login or Register  to view this content.
    you would have to change all of the R#C# numbers to fit your needs

  3. #3
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: VBA formula incorrect, not sure why

    So:
    Please Login or Register  to view this content.
    in R1C1 is:
    Please Login or Register  to view this content.
    I am learning R1C1 and how to program in that style. Also, do I need
    Please Login or Register  to view this content.
    before the IF? Thanks.

  4. #4
    Valued Forum Contributor
    Join Date
    01-19-2012
    Location
    Barrington, IL
    MS-Off Ver
    Excel 2007/2010
    Posts
    1,211

    Re: VBA formula incorrect, not sure why

    Well, the formula I posted was just me recording a macro of placing the formula in the spreadsheet in cell E1 I think, so all of the R1C1 reference values in there (R2C[-5]:R6713C[-5], for example) are values relative to where I placed the formula. You will need to record yourself placing the formula in the locations you want them to go, and use those references in the VBA.

+ 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. [SOLVED] Forumula Results Incorrect when data missing. Wanting to hide the incorrect formula.
    By firemedic6265 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 02-05-2014, 05:01 PM
  2. Incorrect formula outcome
    By leonidas in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-27-2006, 09:25 AM
  3. [SOLVED] Incorrect formula created
    By Amil in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-02-2005, 04:05 PM
  4. [SOLVED] Polynomial Formula Incorrect?
    By DCLittlejohn in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 06-27-2005, 04:05 PM
  5. [SOLVED] formula result incorrect
    By Micayla Bergen in forum Excel General
    Replies: 2
    Last Post: 06-05-2005, 11:05 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