I want to count how many of every fourth cell in a column end with "IM", ignoring any extra spaces following this text.
To assist in this process I have named the collection of cells 'data'.
This is array entered but gives #VALUE. I assume it is the use of TRIM on an array/range (and RIGHT) that is problematic?
A further question is, how can I create this range as dynamic, so that entering some text in another cell three further down will include this cell in the range? Derp.. having moved the formula out of the way, into another column! ;)
Count every fourth
-
- SilverLounger
- Posts: 2403
- Joined: 05 Feb 2010, 22:21
- Location: London ENGLAND
Count every fourth
You do not have the required permissions to view the files attached to this post.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
-
- Administrator
- Posts: 78454
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Count every fourth
TRIM(...) works OK with a contiguous range, but not with a discontiguous one.
=SUM(IF(RIGHT(TRIM(A1:A12),2)="IM",1))
confirmed with Ctrl+Shift+Enter will return 3 in your example. Or as an ordinary formula:
=SUMPRODUCT(--(RIGHT(TRIM(A1:A12),2)="IM"))
To ensure that only cells in rows 1, 4, 7, ... are counted, again as an ordinary formula:
=SUMPRODUCT((RIGHT(TRIM(A1:A12),2)="IM")*(MOD(ROW(A1:A12),3)=1))
=SUM(IF(RIGHT(TRIM(A1:A12),2)="IM",1))
confirmed with Ctrl+Shift+Enter will return 3 in your example. Or as an ordinary formula:
=SUMPRODUCT(--(RIGHT(TRIM(A1:A12),2)="IM"))
To ensure that only cells in rows 1, 4, 7, ... are counted, again as an ordinary formula:
=SUMPRODUCT((RIGHT(TRIM(A1:A12),2)="IM")*(MOD(ROW(A1:A12),3)=1))
Best wishes,
Hans
Hans
-
- SilverLounger
- Posts: 2403
- Joined: 05 Feb 2010, 22:21
- Location: London ENGLAND
Re: Count every fourth
Thank you very much Hans.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.