+ Reply to Thread
Results 1 to 5 of 5

formula issue in VBA

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

    formula issue in VBA

    I also posted this to, but not sure if this is where it should be.
    http://www.mrexcel.com/forum/excel-q...lications.html

    I am having trouble converting a manual formula into VBA:

    The formula below worked great when all the values were on one sheet:

    Code:
    =IF(COUNTIFS( A$2:A$6713,F2,B$2:B$6713,"<="&G2,C$2:C$6713, ">="&G2),VLOOKUP(G2,$B$2:$D$6713,3,1),"No")
    Now I am trying to create a VBA with the values on two sheets, below is what I have:
    VB
    Code:
    Const myEpilepsy As String = "=IF(SUMPRODUCT(--(Panel!$B$2:$B$6713=Annovar!$Q$5),--(Panel!$C$2:$C$6713<=Annovar!$R$5),--(Panel!$D$2:$D$6713>Annovar!$R$5)),VLOOKUP(Annovar!$R$5,Panel!$C$2:$E$6713,3,1),""No"")"
    Thanks.

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

    Re: formula issue in VBA

    I think when placing an Excel formula in VBA you need to use R1C1 format, so G2 is actually (7,2) or something like that. I had to do it once before but don't remember the syntax exactly.

    Also, if that is a CSE formula, and I'm not familiar enough with those yet to tell, I am not sure if it can be entered through VBA. I ran into that issue before and I never did find a solution.

    Hope this helps!

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

    Re: formula issue in VBA

    So if I was writing this formula in R1C1
    Please Login or Register  to view this content.
    it would be:
    Please Login or Register  to view this content.
    Thanks.

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

    Re: formula issue in VBA

    I thought it was more like;
    Please Login or Register  to view this content.
    Or

    Please Login or Register  to view this content.

    Cell A1 will have the formula:
    Please Login or Register  to view this content.
    Does your work? I haven't seen it like that before. I see a lot of R's but no C's
    Last edited by Speshul; 06-26-2014 at 04:45 PM.

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

    Re: formula issue in VBA

    Thank you.

+ 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. Lookup Formula Issue, Search issue
    By kperitz in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 04-07-2014, 01:50 PM
  2. Formula Issue
    By CooperGuy in forum Excel General
    Replies: 1
    Last Post: 01-28-2011, 01:35 PM
  3. #DIV/0! issue - cant get rid of it within another formula
    By skymaster in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-12-2007, 09:36 AM
  4. formula issue
    By poodlelover in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-27-2006, 05:01 AM
  5. formula issue
    By AlienBeans in forum Excel General
    Replies: 7
    Last Post: 05-29-2006, 11:55 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