Excel Formula issue: Counting the number of unique values in a column in another worksheet referred in the formula by the value in another cell

dougmarkham

Active Member
Joined
Jul 19, 2016
Messages
252
Office Version
  1. 365
Platform
  1. Windows
Hi Folks,

I have four worksheets in my DataSplitter Workbook---P0817A, P0817B, P0817C and P0817D---that were generated by splitting data from a central report. Each of these worksheets contains store names in column A that will receive an order.

https://drive.google.com/file/d/1TgCyVeHAXrc48Zhhx3QWHkza1luFJ9Sl/view?usp=sharing

In a fifth worksheet in my DataSplitter wb---DISTRIBUTION ORDER REQUEST---I have a table which needs to generate a count of the number of unique text entries in existing in Column A of worksheets P0817A, P0817B, P0817C and P0817D, which is recorded in the table shown in the link below.

https://drive.google.com/file/d/1gVDY5KP8Lzbh8_V37P9xLjcRiO5aTmYQ/view?usp=sharing

I have found a nice formula---to go into cell "C26" of worksheet "DISTRIBUTION ORDER REQUEST"---that calculates the number of unique text entries in column A:

Code:
=SUMPRODUCT((A:A<>"")/COUNTIF(A:A,A:A&""))

The problem is that I need to refer to the worksheet's location of each column A i.e., in this instance, for worksheets P0817A, P0817B, P0817C and P0817D. Every month this report is run, the names of the split worksheets must differ. For instance, P0817A refers to a report generated for August 2017. Ergo I have used a macro to put the Worksheet names e.g., P0817A, P0817B, P0817C and P0817D into Cells A26:A29 of the worksheet DISTRIBUTION ORDER REQUEST, so that I can refer to them e.g., using cell A26 to define the worksheet that Column A is located.

Sounds complicated, so here is an example of something I've got working. I already have a formula (in cell D26) that counts to total number of text entries (not unique entries):
Code:
=IF(A26="","",COUNTA(INDIRECT("'"&A26&"'!A:A"))-1)

What I'm looking to do is to refer to A26, A27, A28 etc., within
Code:
=SUMPRODUCT((A:A<>"")/COUNTIF(A:A,A:A&""))
so that I can calculate the number of stores for each zone (A, B, C, D) within the report for August.

Would you please help me modify this SUMPRODUCT formula to achieve this?

Kind regards,

Doug.
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
I tried this modification, but I get #NAME error.

Code:
SUMPRODUCT((INDIRECT(“’”&$A26&”’!”&(ADDRESS(2,1)&":"&ADDRESS(5000,1)))<>"")/COUNTIFS(INDIRECT(“’”&$A26&”’!”&(ADDRESS(2,1)&":"&ADDRESS(5000,1))),INDIRECT(“’”&$A26&”’!”&(ADDRESS(2,1)&":"&ADDRESS(5000,1)))&""))
 
Upvote 0

Forum statistics

Threads
1,224,551
Messages
6,179,473
Members
452,915
Latest member
hannnahheileen

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top