LET Function Letting Me Down

Jeffrey Mahoney

Well-known Member
Joined
May 31, 2015
Messages
3,142
Office Version
  1. 365
Platform
  1. Windows
I'm trying to check how many IDs in column A that are not in column E. This is a simple example; my real data is different. Column A looks at column B and normally returns a portion of of the values in column. That formula leaves a blank, but not a true blank. So using Counta(A5:A14) returns 10 even though there are only 4 items. So I have to filter the items for true non-blanks.

The formula in Cell A2 has embedded filtered formulas for columns A and E, then doing the calculation and does not work. While the formula in cell D2 is using filters created in cells C5 and F5 respectively and does work.

Why doesn't the PIDS and PROJS variables store the proper data so the Counta and Countif functions can work? Do I need to reference the array differently when it comes from within the formula? As you can see in the screenshot below, the filter is providing the correct array.

1726763445407.png


Book3
ABCDEF
1MissingMissing
2#VALUE!1
31044104
4PIDIDFilterProjectsFilter
5AAAAA
6BBBCC
7CCCDD
8DDDEE
9 
10 
11 
12 
13 
14 
Sheet1
Cell Formulas
RangeFormula
A2A2=LET(PIDS,FILTER($A$5:$A$14,$A$5:$A$14<>""),PROJS,FILTER($E$5:$E$14,$E$5:$E$14<>""),COUNTA(PIDS)-SUM(COUNTIF(PROJS,PIDS)))
D2D2=COUNTA(C5#)-SUM(COUNTIF(F5#,C5#))
A3:C3,E3:F3A3=COUNTA(A5:A14)
C5:C8C5=FILTER(A5:A14,A5:A14<>"")
F5:F8F5=FILTER(E5:E14,E5:E14<>"")
A5:A14A5=IF(B5<>"",B5,"")
Dynamic array formulas.
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
The Criteria_range in the countifs must be a range, but the filter function returns an array.
 
Upvote 0
Try the following

Let_a.xlsm
AE
21
3
4PIDProjects
5AA
6BC
7CD
8DE
9 
5b
Cell Formulas
RangeFormula
A2A2=COUNTA(FILTER(A5:A8,NOT(COUNTIF(E5:E8,A5:A8))))
A5:A9A5=IF(B5<>"",B5,"")
 
Upvote 0
@Fluff The Countifs function hasn't been updated to accept arrays. I wonder if that will change!?

Ok, the 'NOT' part! . . . I would've never considered it could be used to evaluate ranges or arrays, just math or text matching boolean results. That is so simple looking, but I had to work my way through the logic. Breaking it down inside out.
COUNTIF(E5:E14,A5:A14) = {1;0;1;1;6;6;6;6}
NOT(COUNTIF(E5:E14,A5:A14)) = {F;T;F;F;F;F;F;F;F;F} (T=TRUE, F=FALSE) The zero becomes TRUE
FILTER(A5:A14,NOT(COUNTIF(E5:E14,A5:A14))) = {"B"} Not found on column E list
COUNTA(FILTER(A5:A14,NOT(COUNTIF(E5:E14,A5:A14)))) = 1

Thank you Dave for the formula
 
Upvote 0
Just another option, also - I'm not sure if the formula in post #3 returns a good result when everything in col A has a match in col E?

Book1
ABCDE
1
21
3
4PIDProjects
5AA
6BC
7CD
8DE
Sheet1
Cell Formulas
RangeFormula
A2A2=SUM(--ISNA(MATCH(A5:A8,E5:E8,0)))
 
Upvote 0
Solution
@FormR - No, when all matched the filter portion returned #CALC which would always return at least 1. I tested your formula and it worked great. I did have to switch the two ranges inside the Match function to get it to give me missing values from column E.
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,184
Members
452,615
Latest member
bogeys2birdies

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