Using Filter function to exclde values that are non-integer.

nikolaki

New Member
Joined
Oct 14, 2023
Messages
7
Office Version
  1. 365
Platform
  1. Windows
Hi,
I am trying to filter out values that are non-integers. I have a fairly complex filter function with multiple criteria.

I tried using:

filter(range, (criteria1, include 1 )*(int(a1:a1000)=a1:a1000). I get back #Value

That is, if a value in a1:a1000 is not an integer, I want to exclude that row from the results.

Any help is deeply appreciated
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Welcome to the MrExcel board!

Try this. I have included a check to also exclude any blank cells in the range.

23 10 15.xlsm
ABC
122
289.23-52
3-520
40.1548200
5056
6-1.66
7200
856
91.47
10
Integers only
Cell Formulas
RangeFormula
C1:C5C1=FILTER(A1:A1000,(INT(A1:A1000)=A1:A1000)*(A1:A1000<>""))
Dynamic array formulas.
 
Upvote 0
A1:A1000,(INT(A1:A1000)=A1:A1000)*(A1:A1000<>"")
Thank you so very much. This is the complete Filter function. I am still getting #VALUE#


=FILTER(Margin_Requirements_Details_202!A1:AW39000,
(Margin_Requirements_Details_202!B1:B39000>Sheet1!G3)*(Margin_Requirements_Details_202!C1:C39000="PM")*
(INT(Margin_Requirements_Details_202!G1:G39000)=Margin_Requirements_Details_202!G1:G39000)*
(Margin_Requirements_Details_202!G1:G39000<>"")
)`

If run without the BOLD, it works like a charm. Any ideas?
 
Upvote 0
Sorry, The last ( ' ) at the end was a copy paste error. The function does not have that.
 
Upvote 0
If run without the BOLD, it works like a charm. Any ideas?
Yes. I there are at least 2 causes of a #VALUE! error in that scenario.
  1. There is at least one value in G1:G39000 of 'Margin_Requirements_Details_202' that is text, not numerical. In that sheet, what does this formula return if you put it in a vacant cell?=COUNTA(G1:G39000)-COUNT(G1:G39000)

  2. There is at least one cell in G1:G39000 of 'Margin_Requirements_Details_202' that contains a #VALUE! error already.
 
Upvote 0
Solution
Do you have a formula in Column G that returns "" ?
See if this works:
(added iferror around the int function)

Excel Formula:
=FILTER(Margin_Requirements_Details_202!A1:AW39000,
(Margin_Requirements_Details_202!B1:B39000>Sheet1!G3)*(Margin_Requirements_Details_202!C1:C39000="PM")*
(IFERROR(INT(Margin_Requirements_Details_202!G1:G39000),0)=Margin_Requirements_Details_202!G1:G39000)*
(Margin_Requirements_Details_202!G1:G39000<>""))
 
Upvote 0
Yes. I there are at least 2 causes of a #VALUE! error in that scenario.
  1. There is at least one value in G1:G39000 of 'Margin_Requirements_Details_202' that is text, not numerical. In that sheet, what does this formula return if you put it in a vacant cell?=COUNTA(G1:G39000)-COUNT(G1:G39000)

  2. There is at least one cell in G1:G39000 of 'Margin_Requirements_Details_202' that contains a #VALUE! error already.
G1 was header text. changed in to G2 and it worked!

You are the best. I cant thank you enough
 
Upvote 0
You're welcome. Glad it is sorted. Thanks for the follow-up. :)
 
Upvote 0

Forum statistics

Threads
1,215,093
Messages
6,123,066
Members
449,090
Latest member
fragment

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