+ Reply to Thread
Results 1 to 2 of 2

Finding top 5 countries with a macro button

  1. #1
    Registered User
    Join Date
    02-28-2013
    Location
    Hong Kong
    MS-Off Ver
    Excel 2003
    Posts
    5

    Finding top 5 countries with a macro button

    Hi all,

    How do I get the top 5 countries in different cell with a macro button?
    I have the following data for example:

    First column is country list, second column is inout date

    china Date
    china
    china
    USA
    USA
    Hong Kong
    Hong Kong
    USA
    Germany
    Germany
    UK
    Germany
    UK
    Singapore
    Singapore
    Canada
    UK
    Canada
    Italy
    .......
    I have created an formula in each cell but need Ctrl+shift+enter to work:
    =INDEX('Accepted Cases'!$F$7:$F$65536,MODE(IF(('Accepted Cases'!$F$7:$F$65536<>"")*ISNA(MATCH('Accepted Cases'!$F$7:$F$65536,$B$4:$B4,0))*(('Accepted Cases'!$P$7:$P$65536)>='Summary Country'!$E4)*(('Accepted Cases'!$P$7:$P$65536)<=(DATE(2014,2,28))),MATCH('Accepted Cases'!$F$7:$F$65536,'Accepted Cases'!$F$7:$F$65536,0))))

    How can I show the top 5 countries in 5 different cell by VBA?
    I got the error message:
    "unable to set the formulaarray property of the range class"
    this is what i input:

    Sub top5()

    Application.Calculation = xlCalculationManual
    Range("B5").FormulaArray = "=INDEX('Accepted Cases'!$F$7:$F$65536,MODE(IF(('Accepted Cases'!$F$7:$F$65536<>"")*ISNA(MATCH('Accepted Cases'!$F$7:$F$65536,$B$4:$B4,0))*(('Accepted Cases'!$P$7:$P$65536)>='Summary Country'!$E4)*(('Accepted Cases'!$P$7:$P$65536)<=(DATE(2014,2,28))),MATCH('Accepted Cases'!$F$7:$F$65536,'Accepted Cases'!$F$7:$F$65536,0))))"

    End Sub

    Thank you
    Jen

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Finding top 5 countries with a macro button

    Welcome to the forum.

    We'd like to help you but first..

    Pls take some minutes to read forum rules and specially-in this case- rule#3
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

+ 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] Macro button copies sheet containing a macro button as an image
    By namso1902 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-02-2013, 03:51 PM
  2. A macro to create a form button, assign a macro and name the button
    By cl361 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-11-2008, 01:07 AM
  3. [SOLVED] Using Excel in different countries
    By Giri in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-19-2005, 09:35 AM
  4. [SOLVED] Finding Row or Button Name
    By Trefor in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-23-2005, 09:05 AM
  5. world countries
    By zaifi in forum Excel General
    Replies: 1
    Last Post: 10-12-2005, 05: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