I am using this function to search whether the Domain value of the current table is found in the Domain column of the Domain.List table, returning TRUE/FALSE:

```
=NOT(ISERROR(VLOOKUP([@Domain],Domain.List[Domain],1,FALSE)))
```

When this Domain.List is filtered, there will be fewer entries.For example:

```
DOMAIN INCLUDE
google.com 0
apple.com 1
amazon.com 0
alibaba.com 0
```

when filtered by include, will become:

```
DOMAIN INCLUDE
apple.com 1
```

Now back at the original table, I want the function above to return TRUE only for domains matching apple.com.

But in fact, the function result does not change regardless of the filter state of the Domain.List table.

Is there any way to tell Excel that I only want to run the formula against the visible portion of the Domain.List[Domain] column?

Change your formula to:

```
=IF(SUMPRODUCT(SUBTOTAL(3,OFFSET(Domain.List[DOMAIN],ROW(Domain.List)-MIN(ROW(Domain.List[DOMAIN])),,1)),ISNUMBER(SEARCH([@Domain],Domain.List[DOMAIN]))+0),TRUE,FALSE)
```

In sheet:

There is a really nice explanation of how this works here: Count visible rows only with criteria

To partially quote:

You use SUMPRODUCT to apply both the SUBTOTAL function (via OFFSET) and the criteria – e.g. = `apple.com`

( The second part `ISNUMBER(SEARCH([@Domain],Domain.List[DOMAIN]))+0`

is a sort of boolean shorthanded with SEARCH ISNUMBER. You will generate a TRUE FALSE list).

SUBTOTAL can exclude hidden rows of SUMPRODUCT. As SUBTOTAL returns a single number, while SUMPRODUCT needs an array, we use OFFSET to feed SUBTOTAL one reference per row, so that OFFSET will return one result per row.

That is done by giving OFFSET an array that contains one number per row, starting with zero, which is generated by:

```
ROW(Domain.List)-MIN(ROW(Domain.List[DOMAIN]))
```

You are basically multipling two arrays, the first saying is row visible and the second saying does it match the Domain name. This is then wrapped in an If formula to generate the required TRUE, FALSE. I rely on the fact 1 = TRUE to shorthand the formula from:

```
=IF(SUMPRODUCT(SUBTOTAL(3,OFFSET(Domain.List[DOMAIN],ROW(Domain.List)-MIN(ROW(Domain.List[DOMAIN])),,1)),ISNUMBER(SEARCH([@Domain],Domain.List[DOMAIN]))+0)=1,TRUE,FALSE)
```

which is `IF(result = 1, TRUE,FALSE)`

to simply `IF(result , TRUE,FALSE)`

i.e. `IF(1 , TRUE,FALSE)`

Tags: excelexcel, filter