SUMPRODUCT uniques

Fin Fang Foom

Well-known Member
Joined
Mar 20, 2005
Messages
598
Hi everyone,

Is it possible to have this formula work across multiple worksheets?, Without any addin.

=SUMPRODUCT(--(A3:A100="a"),--(MATCH(B3:B100&C3:C100,B3:B100&C3:C100,0)=ROW(INDEX(A3:A100,0))-ROW($A$3)+1),D3:D100)
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Hi everyone,

Is it possible to have this formula work across multiple worksheets?, Without any addin.

=SUMPRODUCT(--(A3:A100="a"),--(MATCH(B3:B100&C3:C100,B3:B100&C3:C100,0)=ROW(INDEX(A3:A100,0))-ROW($A$3)+1),D3:D100)

MATCH() needs a vector, so it cannot cope with a 3d result.
 
Upvote 0
Here is a visual sense what I'm looking for. This formula below will look in column B & C and count the uniques. The result is 9.

=SUM(N(FREQUENCY(Sheet2:Sheet3!B2:C100,Sheet2:Sheet3!B2:C100)>0))

But what I need from the formula above is to look in column A and find the text "a" and compare the columns B & C and then sum up in column D

Here are the examples below. The result of the formula should be 500. I color the rows where the formula should sum up from.


Sheet2:
Book3
ABCD
1
2a1010100
3e1010100
4a55100
5b71100
6c102100
7z9010100
8
Sheet2


Sheet3:
Book3
ABCD
1
2b81100
3a101100
4a55100
5a103100
6a1010100
7a5610100
8
Sheet3
 
Upvote 0
I don't have a single formula solution to offer, however, I do have two possible solutions each requiring helper columns. Note that I've assumed that the format for Sheet2 and Sheet3 is consistent.

[Option 1]

1) Group Sheet2 and Sheet3 by first clicking on the tab for Sheet2 and then CONTROL+Clicking on the tab for Sheet3.

2) Enter the following formula in E2, and copy down:

=IF(A2="A",B2&"#"&C2,"")

3) On your summary sheet, let's say Sheet1, let A2 and B2 contain the sheet names Sheet2 and Sheet3.

4) Then try the following formula, which needs to be confirmed with CONTROL+SHIFT+ENTER...

=SUM(IF(T(OFFSET(INDIRECT("'"&A2&"'!A2:A7"),ROW(INDIRECT("2:7"))-2,,1))="A",(1/MMULT(COUNTIF(INDIRECT("'"&A2:B2&"'!E2:E7"),INDIRECT("'"&A2&"'!E2:E7")),{1;1}))*(N(OFFSET(INDIRECT("'"&A2&"'!D2:D7"),ROW(INDIRECT("2:7"))-2,,1))),""))+SUM(IF(T(OFFSET(INDIRECT("'"&B2&"'!A2:A7"),ROW(INDIRECT("2:7"))-2,,1))="A",(1/MMULT(COUNTIF(INDIRECT("'"&A2:B2&"'!E2:E7"),INDIRECT("'"&B2&"'!E2:E7")),{1;1}))*(N(OFFSET(INDIRECT("'"&B2&"'!D2:D7"),ROW(INDIRECT("2:7"))-2,,1))),""))

[Option 2]

1) On your summary sheet, let's say Sheet1, let A2 and B2 contain the sheet names Sheet2 and Sheet3.

2) On your summary sheet, select A3:B8. With these cells selected/highlighted, enter the following formula and confirm with CONTROL+SHIFT+ENTER...

=IF(T(OFFSET(INDIRECT("'"&A2:B2&"'!A2:A7"),ROW(INDIRECT("2:7"))-2,,1))="A",N(OFFSET(INDIRECT("'"&A2:B2&"'!B2:B7"),ROW(INDIRECT("2:7"))-2,,1))&"#"&N(OFFSET(INDIRECT("'"&A2:B2&"'!C2:C7"),ROW(INDIRECT("2:7"))-2,,1)),"")

3) Then try the following formula, which needs to be confirmed with CONTROL+SHIFT+ENTER...

=SUM(IF(A3:B8<>"",(1/COUNTIF(A3:B8,A3:B8))*(N(OFFSET(INDIRECT("'"&A2:B2&"'!D2:D7"),ROW(INDIRECT("2:7"))-2,,1)))))

Hope this helps!
 
Upvote 0
Thank You very much Domenic.

I will be taking Option 2. Once again thank you for taking out of your time to help me.
 
Upvote 0

Forum statistics

Threads
1,216,126
Messages
6,129,008
Members
449,480
Latest member
yesitisasport

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