Question: I'm really having problems writing a MID formula to extract the due date (always the same length) and Row count (variable length). Could anybody help me please? I'm getting a little lost with nested formulas.

Project in Batch 100 of 120 for A2B\_1414696641872. Due date: **2014-11-03**. Word count: 1976. Row count: **345**.

Strings in column A, column B should contain 2014-11-03 and column C should contain 345

Project in Batch 10 of 12 for A2B\_141469664. Due date: **2014-11-03**. Word count: 19. Row count: **3**.

Strings in column A, column B should contain 2014-11-03 and column C should contain 19

--

I currently have the following for extracting the due date (it works):

```
=MID(LEFT(B1,FIND(". Word count",B1)-1),FIND("Due date:",B1)+10,LEN(B1))

```

Answer: 
Use nested list comprehension:

```
[x for x in [map_to_obj(v) for v in v_list] if x]

```

or better still, a list comprehension around a generator expression:

```
[x for x in (map_to_obj(v) for v in v_list) if x]

```
List comprehensions are fine for the simple cases, but sometimes a plain old `for` loop is the simplest solution:

```
other_list = []
for v in v_list:
    obj = map_to_obj(v)
    if obj:
        other_list.append(obj)

```

Now if you really want a list comp and dont want to build an tmp list, you can use the iterator versions of `filter` and `map`:

```
import itertools as it
result = list(it.ifilter(None, it.imap(map_to_obj, v_list)))

```

or more simply :

```
import itertools as it
result = filter(None, it.imap(map_to_obj, v_list)))

```

The iterator versions don't build a temporary list, they use lazy evaluation.