@svenimhoz

The problem comes from

```
REGEXEXTRACT({Voornaam}, "-([A-Z])")
```

If you create a formula with only this syntax, youâ€™ll see that if the first name is without hyphen, the column cell is empty. You would think that it returned an empty stringâ€¦

But if you test it by changing the syntax to the following

```
ISNONTEXT(REGEXEXTRACT({Voornaam}, "-([A-Z])"))
```

the result is **True**. So, in fact, it does NOT return an empty string.

The question is what does it return then?

```
ISBLANK(REGEXEXTRACT({Voornaam}, "-([A-Z])"))
```

returns **True**, i.e. it returns an **empty object**.

**Why the error?**

For 2 reasons:

- when you do " " & (REGEXEXTRACT({Voornaam}, â€ś-([A-Z])â€ť) and the firstname has no hyphen, youâ€™re concatening a space with an empty object which is not possible therefore the error. Youâ€™re probably thinking â€śthis is not true because I added an if statement checking if there is an hyphen in the nameâ€ťâ€¦ Indeed but you need to know the following:
- when you run an if statement, If(Condition, resultIfTrue, resultIfFalse), as counterintuitive as it may seem, resultIfTrue and resultIfFalse are â€ścalculatedâ€ť first then only the one meeting the condition is returned by the function. It seems logical to assume that if the condition is met, resultIfFalse is never calculated because it is unnecessary to calculate it. But, in fact, both are calculated upfront. So if one of the 2 potential results generates an error no matter whether the condition is met or not, youâ€™ll get an error.

**Now, what is the SOLUTION?**

The solution is to NOT concatenate your space and period within the if statement with the REGEXTRACT function.

Try the following. It should work.

```
REGEXEXTRACT({Voornaam}, "^[A-Z]") & "." &
IF(ISBLANK(REGEXEXTRACT({Voornaam}, "-([A-Z])")),"", " ") &
IF(ISBLANK(REGEXEXTRACT({Voornaam}, "-([A-Z])")),"", REGEXEXTRACT({Voornaam}, "-([A-Z])")) &
IF(ISBLANK(REGEXEXTRACT({Voornaam}, "-([A-Z])")),"", ".") &
IF(ISBLANK(REGEXEXTRACT({Voornaam}, "\s[A-Z]")), "", REGEXEXTRACT({Voornaam}, "\s[A-Z]")) &
IF(ISBLANK(REGEXEXTRACT({Voornaam}, "\s[A-Z]")), "", ".")
```