Southall_Legend
New Member
- Joined
- Mar 31, 2017
- Messages
- 2
Hi everybody!
First time poster, and VBA newbie here. I've been trawling the internet and racking my brains to try to solve my problem but haven't got anywhere, so thought I'd register on here to see if anyone can help...
The issue I have is that I'm trying to analyse a formula and I want to be able to count the number of cell references and fixed values in that formula, whilst counting ranges as one. FWIW I'm doing this to analyse the complexity of a formula.
I did think that counting precedents would do this for me, but this count's the number of direct precedents in a range (aka A1:C1 gives "three", whereas I want "one"), and also doesn't work with precedents on a different sheet
So a quick few examples:
[TABLE="width: 500"]
<tbody>[TR]
[TD]Formula[/TD]
[TD]# of cell refs[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]=A1+B1[/TD]
[TD]2[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]=SUM(A1:B1)[/TD]
[TD]1[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]=1+SUM(B1:C1)[/TD]
[TD]2[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]=IF(A1=1,B1,C1)[/TD]
[TD]4[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
It's more than possible that there's some obvious way of doing this, staring me in the face; or that some of the information above is incorrect - as I am a newbie. Any help would be greatly appreciated though.
Alternatively, if anyone has a different method of measuring formula complexity, I'd be happy to consider completely different methods.
Thanks
First time poster, and VBA newbie here. I've been trawling the internet and racking my brains to try to solve my problem but haven't got anywhere, so thought I'd register on here to see if anyone can help...
The issue I have is that I'm trying to analyse a formula and I want to be able to count the number of cell references and fixed values in that formula, whilst counting ranges as one. FWIW I'm doing this to analyse the complexity of a formula.
I did think that counting precedents would do this for me, but this count's the number of direct precedents in a range (aka A1:C1 gives "three", whereas I want "one"), and also doesn't work with precedents on a different sheet
So a quick few examples:
[TABLE="width: 500"]
<tbody>[TR]
[TD]Formula[/TD]
[TD]# of cell refs[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]=A1+B1[/TD]
[TD]2[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]=SUM(A1:B1)[/TD]
[TD]1[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]=1+SUM(B1:C1)[/TD]
[TD]2[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]=IF(A1=1,B1,C1)[/TD]
[TD]4[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
It's more than possible that there's some obvious way of doing this, staring me in the face; or that some of the information above is incorrect - as I am a newbie. Any help would be greatly appreciated though.
Alternatively, if anyone has a different method of measuring formula complexity, I'd be happy to consider completely different methods.
Thanks