# The Index function (Table3,0,3) returns a value !!! Was an error expected?

#### herclau

##### Member
I do not understand the behavior of the Index function, in this case I show. The solution I found is shown in the accompanying column.
How is it that Index (Table3,0,3) Row = 0? return a value; an error was expected !!!
Why this behavior? Could you explain to me, please!
That would be the right thing to avoid this error

#### Attachments

• 21 KB Views: 7

#### AliGW

##### Active Member
What exactly are you expecting this bit of the formula to do?

=IF(MOD(@Vseq-1,repeat)=0,0,INT((@Vseq-1)/repeat)+1)

It's not returning a row number, is it? Try it on its own in another column.

#### vletm

##### Excel Ninja
herclau
If You could solve that like this?
... without any index-formulas, which always works correct way.

#### Attachments

• 20.9 KB Views: 5

#### Peter Bartholomew

##### Well-Known Member
The index function expects positive integers for the row and column indices. However 0 or blank is also valid, in which case INDEX returns an entire row or column as a range reference. What happens next depends on whether the formula is an array formula or not but you cannot assume it will return an error.

#### Peter Bartholomew

##### Well-Known Member
As a solution, I would recommend replacing the 0 index by NA() to force the error you need.

#### Peter Bartholomew

##### Well-Known Member
The chart in the attached file also contains a normal probability density distribution.
Down amongst the formulas, I have changed the logic to prevent the formula trying to lookup a zero value. That would avoid your error with INDEX but also works when using LOOKUP, as here. The reason for the change to LOOKUP was because that function behaves better than INDEX when an array of results is needed.

#### Attachments

• 19.2 KB Views: 9

#### herclau

##### Member
The chart in the attached file also contains a normal probability density distribution.
Down amongst the formulas, I have changed the logic to prevent the formula trying to lookup a zero value. That would avoid your error with INDEX but also works when using LOOKUP, as here. The reason for the change to LOOKUP was because that function behaves better than INDEX when an array of results is needed.
Hi Peter Bartholomew:
Following the methodology shown in the previous file.
Will it be possible to enter the values of the column res in a variable, "Y".?

#### Attachments

• 10.3 KB Views: 0