Consulting

Results 1 to 2 of 2

Thread: from a formula to a macro

  1. #1
    VBAX Regular
    Joined
    Jul 2017
    Posts
    7
    Location

    from a formula to a macro

    Hi to all,
    in the attached workbook there is a formula in C2 sheet categories
    =SUM(IF(A2=Dati!$A$2:$A$5000,1/COUNTIFS(Dati!$A$2:$A$5000,A2,Dati!$B$2:$B$5000,Dati!$B$2:$B$5000)))
    Is possible the same function with a Macro?
    The original sheet is composed of many lines and with the formula is very slow.

    conta univoci.xlsx

    max_max

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Create a pivot table, make sure you check the box Add to DataModel, then put Categoria in the Rows pane, Prov. in the Values pane, right click on the item in the values pane, Seklect the Value Field Settings option, then scroll down to Distinct Count. Voila, no formulae, no macros.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •