PDA

View Full Version : from a formula to a macro



max_max
09-24-2017, 07:02 AM
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.

20449

max_max

Bob Phillips
09-24-2017, 01:23 PM
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.