+ Reply to Thread
Results 1 to 12 of 12

using formula in vba

  1. #1
    Registered User
    Join Date
    04-05-2012
    Location
    chennai
    MS-Off Ver
    Excel 2010
    Posts
    49

    using formula in vba

    Hi . i want to use this formula =SUMPRODUCT((A2:A10000<>"")/COUNTIF(A2:A10000,A2:A10000&"")) on cell D10 in sheet 1, how do i write it using vba ?? can some one help

  2. #2
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: using formula in vba

    Like this:

    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: using formula in vba

    Hi plk,

    Try this:

    Please Login or Register  to view this content.
    HTH

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,050

    Re: using formula in vba

    I would cheat:

    Please Login or Register  to view this content.

    ... but at least you know exactly what you are getting and why.

    If the formula works, you'll get the value you expect.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: using formula in vba

    Or if you want it in the cell as the above answers suggest:
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    04-05-2012
    Location
    chennai
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: using formula in vba

    Hi ALL thanks for your reply..i have the formula used in sheet2 to calculate unique rows and i want the result to be displayed on D10 cell in sheet 1 .. can any one help.. thanks

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,050

    Re: using formula in vba

    Is that a different question? If it is, you should start a new thread.

    Either way, I don't understand what you want, so please provide a more detailed explanation and, ideally, a sample workbook with a mock of what you hope to achieve.

    Regards, TMS

  8. #8
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: using formula in vba

    i have the formula used in sheet2 to calculate unique rows and i want the result to be displayed on D10 cell in sheet 1
    Just link cell D10 of Sheet1 to the relevant cell in Sheet2, i.e. if your formula is housed in cell A5 of Sheet2, you'd use this in cell D10 of Sheet1:

    =Sheet2!A5

    Just change the cell reference (i.e. A5) to suit.

  9. #9
    Registered User
    Join Date
    04-05-2012
    Location
    chennai
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: using formula in vba

    Hi all i have just attached a sample workbook, can you please help me to implement the formula on Macro to solve this problem.. and this is the same thread with same question. thanks
    Attached Files Attached Files

  10. #10
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: using formula in vba

    Hi plk,

    Try this:

    Please Login or Register  to view this content.
    Note there are nine unique entries, not eight as the data starts from row one, not row two as your formula stated. I've also included code to find the last row from column A.

    HTH

    Robert

  11. #11
    Registered User
    Join Date
    04-05-2012
    Location
    chennai
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: using formula in vba

    thanks a lot trebor.. i managed with ur earlier formula and gave the reference manually now i will change the reference to code.. thanks a lot for your timely help u made my day..i wouldnot forget this..thanks a lot...

  12. #12
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: using formula in vba

    Hi plk,

    Thanks for the feedback and for adding to my reputation. I'm glad it's all sorted now.

    Regards,

    Robert

+ 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