# of unique entries across 2 tabs (excluding duplicates and empty cells)

virtuosok

Board Regular
Joined
Sep 2, 2020
Messages
209
Office Version
  1. 365
Platform
  1. Windows
Hi,
This one is a bit complicated... I currently have a working array formula to look up the # of unique dates on one single tab in line with pre-defined criteria:
{=SUM(IF(FREQUENCY(IF('Tab one'!$E$13:$E$50000=B4,'Tab one'!$F$13:$F$50000),'Tab one'!$F$13:$F$50000),1))}

Can I have this formula working across two tabs (let's say another one will be called Tab two), looking into exactly the same ranges and following the same logic? As an option, totally different formula will work just as well, as long as it returns valid results.
Please help :)
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
...or maybe I should do something along the lines of
=countunique(iferror(filter($F$13:$F$50000, $E$13:E=B4)))
...however how to make sure it works across 2 tabs?

Another type of formula would be =SUMPRODUCT(--(FREQUENCY(Sheet1:Sheet2!... but still cannot figure out the exact syntax...
 
Upvote 0
How about:

Book1
ABCDEF
1
2
3
4a
54
6
7
8
9
10
11
12
13a2-Sep
14a3-Sep
15b5-Sep
16
17
Tab one
Cell Formulas
RangeFormula
B5B5=SUM(IF(FREQUENCY(IF('Tab one'!$E$13:$E$50000=B4,'Tab one'!$F$13:$F$50000),ROW(INDIRECT("1:60000")))+FREQUENCY(IF('Tab two'!$E$13:$E$50000=B4,'Tab two'!$F$13:$F$50000),ROW(INDIRECT("1:60000"))),1))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Goodness, thanks a million Eric W! This works like a charm! Appreciate your help so much!!!
Now that you helped me how to figure out the # of unique dates across two tabs, would you mind reviewing my formula for the first - and the last - dates in either tab, for a specific criterion? My current formulas which only take into account Tab one, look as follows, and they work well but I would need them to scan both tabs (same ranges):
=MIN(IF('Tab one'!$E$13:$E$50000=B2,'Tab one'!$F$13:$F$50000))
=MAX(IF('Tab one'!$E$13:$E$50000=B2,'Tab one'!$F$13:$F$50000))
 
Upvote 0
It should just be:

Excel Formula:
=MAX(IF('Tab one'!$E$13:$E$50000=B2,'Tab one'!$F$13:$F$50000),IF('Tab two'!$E$13:$E$50000=B2,'Tab two'!$F$13:$F$50000))

with CSE.
 
Upvote 0
It should just be:

Excel Formula:
=MAX(IF('Tab one'!$E$13:$E$50000=B2,'Tab one'!$F$13:$F$50000),IF('Tab two'!$E$13:$E$50000=B2,'Tab two'!$F$13:$F$50000))

with CSE.
Works perfectly! Thanks a lot, you made my week!!!
 
Upvote 0
Hi Eric W (and everyone :) )
Can you tell me please what the bit in red font does in human understandable terms? I am taking the formula from message #3 in this thread. Why exactly 60000?

=SUM(IF(FREQUENCY(IF('Tab one'!$E$13:$E$50000=B4,'Tab one'!$F$13:$F$50000),ROW(INDIRECT("1:60000")))+FREQUENCY(IF('Tab two'!$E$13:$E$50000=B4,'Tab two'!$F$13:$F$50000),ROW(INDIRECT("1:60000"))),1))
 
Upvote 0
60000 was just a convenient number. You were looking at dates, and Excel stores dates as numbers. January 1, 1900 is 1, today (10/7/2020) is 44111, and 60000 is 4/8/2064. I made the assumption that your dates would be no more than 44 years in the future. If the data you're looking at were just random numbers or text, the formula would be more complicated.
 
Upvote 0
Thanks Eric W, this explains (and yes, 44 years is more than enough :) )
The formula works in all instances except for one in my specific case - and I'm trying to figure out what's wrong with that one. Then my second attempt would be to streamline the blue bits:
=SUM(IF(FREQUENCY(IF('Tab one'!$E$13:$E$50000=B4,'Tab one'!$F$13:$F$50000),ROW(INDIRECT("1:60000")))+FREQUENCY(IF('Tab two'!$E$13:$E$50000=B4,'Tab two'!$F$13:$F$50000),ROW(INDIRECT("1:60000"))),1))

I tried to replace the blue bits with
E:E
$E$13:E
...and other variants of spellings, but consistently failed. Essentially I need the formula to take into account all entries from E13 downward, and that range contains only dates.
 
Upvote 0
Since there are 1,048,576 rows in an Excel 2016 sheet, you can change it to:

=SUM(IF(FREQUENCY(IF('Tab one'!$E$13:$E$1048576 =B4,'Tab one'!$F$13:$F$1048576),ROW(INDIRECT("1:60000")))+FREQUENCY(IF('Tab two'!$E$13:$E$1048576=B4,'Tab two'!$F$13:$F$1048576),ROW(INDIRECT("1:60000"))),1))

or if you know that E1:E12 will never match B4, you can use the whole column references:

=SUM(IF(FREQUENCY(IF('Tab one'!$E:$E=B4,'Tab one'!$F:$F),ROW(INDIRECT("1:60000")))+FREQUENCY(IF('Tab two'!$E:$E=B4,'Tab two'!$F:$F),ROW(INDIRECT("1:60000"))),1))

But I warn you that using whole column references can slow down your sheet a lot. If you have 100,000 rows you need to check, then this formula will still do 10 times the work that it has to. If you notice slow processing, we can try to come up with a dynamic range formula that looks for the last used row and incorporate that.
 
Upvote 0

Forum statistics

Threads
1,215,046
Messages
6,122,852
Members
449,096
Latest member
Erald

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