Archive of Mr Excel Message Board
I use this array formula
{=IF(((A1:A10<B1)+(A1:A10>C1))*((A1:A10<B2)+(A1:A10>C2)),A1:A10,0)}
to get {1;2;0;0;0;6;7;0;0;10}
which makes number 3 to 5 and number 8 to 9 to be 0 instead.
Is there any shorter array formula?
My real situation has number from 150 to 25000 that need to replace number from 200-250, 400-570, 15000-16000, 21200-23400 to be 0. Interval of 0 may be change and/or increase/decrease in future.
I understand deeply enough for array and vba. Please advise array formula.
Thanks,
Somkiat

| Check out our Excel Resources | ||||
![]() |
![]() |
|||
{=IF(((A1:A10 less than B1)+(A1:A10 greater than C1))*((A1:A10 less than B2)+(A1:A10 greater than C2)),A1:A10,0)}
to get {1;2;0;0;0;6;7;0;0;10}

=((A1:A10 < B1)+(A1:A10 > C1))*((A1:A10 < B2)+(A1:A10 > C2))*A1:A10
Juan Pablo G.
