# Calculate Av of col B using unique values in col A

#### towners

##### Board Regular
Hi,

I have customer numbers in column A with the number of visits in column B.

There are duplicates in the customer number column (one record per visit), I calculated column B to count the number of visits for each customer so I will have the calculated number of visits also duplicated for each duplicate customer.

i.e.

Customer 1 - number visits 1
Customer 2 - number visits 2
Customer 2 - number visits 2
Customer 3 - number visits 3
Customer 3 - number visits 3
Customer 3 - number visits 3
Customer 4 - number visits 1

I want to calculate, using a formula the average number of visits for unique instances of customer.
And, the percentage of customers visited more than once.

So my calculation would be (average column B for column A unique values only)

Any help would be appreciated.

Thanks

Towners

### Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

#### DHayes

##### Board Regular
Hope this is what you need.
 Customer 1 - number visits 1 Customer 2 - number visits 2 Customer 2 - number visits 2 Customer 3 - number visits 3 Customer 3 - number visits 3 Customer 3 - number visits 3 Customer 4 - number visits 1 Customer 1 1 Customer 2 2 Customer 3 3 Customer 4 1

<tbody>
</tbody>

Formula
Code:
``=IFERROR(AVERAGEIFS(\$D\$1:\$D\$7,\$A\$1:\$A\$7,A10,\$D\$1:\$D\$7,">1"),1)``

#### towners

##### Board Regular
Hi,

Thanks for the formula. I'm not getting the result I expected though.

I use this formula to count the number of unique values in my column A (it's a named range called "D_CustomerID") with a couple of criteria.

Code:
``{=SUM(--(FREQUENCY(IF((D_FirstDeliveryYearMonth=AY\$2)*(D_PT_Brand<>"NONE"),MATCH(D_CustomerID,D_CustomerID,0)),ROW(D_CustomerID)-ROW(D_FirstCustomerID)+1)>0))}``

I was wondering how I would adapt this (now I know the number of unique occurrences) to produce the average of Column B

Last edited:

Replies
4
Views
128
Replies
0
Views
144
Replies
10
Views
580
Replies
4
Views
240
Replies
1
Views
101

1,195,952
Messages
6,012,506
Members
441,703
Latest member
clivelincoln

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back