Circular reference when using Indirect Function... Not sure why

RobClay

New Member
Joined
Oct 16, 2012
Messages
8
Preface: I am not expert, but have been viewing the message boards, especially here for some advice on a spreadsheet I have been building.

I have a formula that will review an array (Values in E4 through E100) and let me know if it is the first time a value (In Column E) is seen and display a 1, or a repeat of a previous value, and display an "R". This is the formula that would be used in A7:
=IF(ROW(INDEX(($E$4:$E$100),+MATCH(E7,$E$4:$E$100,0),0))=ROW(),1,"R")

This works.

Now I want to use the indirect function so that I can just put in the number of rows in the array:

In Cell C1 I put in the value 100.
In A7:
=IF(ROW(INDEX(INDIRECT("$E$4:$E$"&$C$1),+MATCH(E7,INDIRECT("$E$4:$E$"&$C$1),0),0))=ROW(),1,"R")

This gives me a circular reference. It's probably obvious, but I am unsure why. Any suggestions or a better formula?

Thanks!
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Hi and welcome to MrExcel Forum,

Considering that the values begin at E4, maybe you can simply use this formula in A4

=IF(MATCH(E4,E:E,0)=ROW(),1,"R")
copy down

M.
 
Upvote 0
Carrying this further... this has me discovering other circular references... all of which 'work' and I get the results I seek...

In Cell A17, I want to count the following 4 cells under it to see if they have a "1" in them. I use the following:
=COUNTIF(A18:A21,1) and it returns 4 (as expected assuming all A18, A19, A20, A21 each have 1 in them.

Now I want to use the indirect function to get the same results, so in A17 I use:
COUNTIF(INDIRECT("A"&ROW()+1&":A21"),1) and it returns a 4, but also gives me a circular reference error.

Am I using indirect incorrectly?


(
As an aside:
In case one is wondering where this leads me, or why, I eventually will have a formula that does the following:
=COUNTIF(INDIRECT("A"&ROW()+1&":A"&ROW()+[Formula to Calculate Number of Rows I want to test]),1)
)
 
Upvote 0
Looking at others with similar problems, it seems as though the row() and indirect do not like each other.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,326
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top