# Thread: Formula with INDEX and IF Thanks: 0 Likes: 0

1. ## Formula with INDEX and IF

I have a fairly simple formula that I am trying to amend so that inserting a line does not cause the cell values to change using the INDEX command. The formula I was using was:

=IF(E6>0, E6, 0)

Which I have updated to:

=IF(INDEX(C:E,3,3>0),INDEX(C:E,3,3,0))

This produces a #VALUE error so I am obviously have the formatting wrong but cant get my head around what to change, can anyone help?

2. ## Re: Formula with INDEX and IF

That IF INDEX combination is always true so you will always return INDEX(C:E,3,3) I.e. the 3rd row and 3rd column of C:E (E3)

It is nested incorrectly hence the error,

It would look like:
=IF(INDEX(C:E,3,3>0),INDEX(C:E,3,3),0)

Though this looks a bit weird to me!!

3. ## Re: Formula with INDEX and IF

If you want E6 it should be
=IF(INDEX(C:E,6,3)>0,INDEX(C:E,6,3),0)

4. ## Re: Formula with INDEX and IF

I think it should look more like:

=IF(INDEX(C:E,6,3)>0,INDEX(C:E,6,3),0)

Change the 6 to 3 if you really meant to say E3 in your description.

5. ## Re: Formula with INDEX and IF

Whats behind the decision to use index thats just pointing at a fixed cell?