Filter Expression Help

Jmal22

New Member
Joined
Feb 26, 2024
Messages
2
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2016
  5. 2013
Platform
  1. Windows
  2. MacOS
Could someone please tell me why excel giving me #Name when using this expression?

ActiveCell.Formula2 = "=Filter(EnabledwithPriority!A2:DE&RowCount),(EnabledwithPriority!V2:V&RowCount<>""""),"""")"

Excel sees RowCount in this expression as a word and not a row number for column DE.
RowCount is a dynamic number that is changing. I done this before in expressions like Range("A2:DE" & RowCount) but that doesn't work using the filter function.
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
You are missing some parenthesis:

VBA Code:
ActiveCell.Formula2 = "=FILTER(EnabledwithPriority!A2:DE" & RowCount & "),(EnabledwithPriority!V2:V" & RowCount & "<>""""),"""")"
 
Upvote 0
You are missing some parenthesis:

VBA Code:
ActiveCell.Formula2 = "=FILTER(EnabledwithPriority!A2:DE" & RowCount & "),(EnabledwithPriority!V2:V" & RowCount & "<>""""),"""")"
That worked, thank you!!!
 
Upvote 0
That worked, thank you!!!
Did you manually update your formula ? dreid's formula as posted has one too many parenthesis in it and can't possibly have worked.

1708994732589.png
 
Upvote 0
You are missing some parenthesis:
I would argue there are too many rather than not enough, though that is not a particular problem. The main reason for my post is to comment that I generally find it easier to get the right formula format by using placeholder(s) in the formula and then doing one or more 'Replace' actions rather that breaking the formula into lots of pieces to insert the variable value(s).

So the blue part is like the actual formula except with # holding the place(s) where the final row number should be (& the doubled-up quotes of course)
and then Replace just drops in the RowCount value into the relevant place(s)

Rich (BB code):
ActiveCell.Formula2 = Replace("=FILTER(EnabledwithPriority!A2:DE#,EnabledwithPriority!V2:V#<>"""","""")", "#", RowCount)
 
Upvote 0
@dreid1011 - I normally get caught out when I do a final tweak directly in the post.
I also find the replace method easier but its good to know how both methods work.
 
Upvote 0
I would argue there are too many rather than not enough, though that is not a particular problem. The main reason for my post is to comment that I generally find it easier to get the right formula format by using placeholder(s) in the formula and then doing one or more 'Replace' actions rather that breaking the formula into lots of pieces to insert the variable value(s).

So the blue part is like the actual formula except with # holding the place(s) where the final row number should be (& the doubled-up quotes of course)
and then Replace just drops in the RowCount value into the relevant place(s)

Rich (BB code):
ActiveCell.Formula2 = Replace("=FILTER(EnabledwithPriority!A2:DE#,EnabledwithPriority!V2:V#<>"""","""")", "#", RowCount)
Right, I realize now I wrote parenthesis, when I really meant quotation marks... Again, oops. I did write it to a string to make sure I had all the quotes I needed, but I wasn't paying attention to the closing ')' in the middle where it shouldn't have been.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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