leeksleeks
Board Regular
- Joined
- Oct 31, 2013
- Messages
- 96
Hi,
I have read a lot of forums discussing merged cells and how to calculate the number of merged cells based on the criteria given, however the formula below only returns the number of merged cells for the first set of merged cells and not for the entire column. If I wanted to count the number of merged cells in column D that had the word "Apple" in them and this was present in Cells D4:D10 and then D16:24 and finally in D45:D49 it would only return the count from the first instance so in this case it would return 7.
Here is the code i am using which is fairly generic on the forums:
and then the code I have in the worksheet which has the word Apple in cell A70 is:
Anyone got any ideas how to return a value which counts every instance in a column with merged cells based on a keyword like Apple?
Cheers,
Alex
I have read a lot of forums discussing merged cells and how to calculate the number of merged cells based on the criteria given, however the formula below only returns the number of merged cells for the first set of merged cells and not for the entire column. If I wanted to count the number of merged cells in column D that had the word "Apple" in them and this was present in Cells D4:D10 and then D16:24 and finally in D45:D49 it would only return the count from the first instance so in this case it would return 7.
Here is the code i am using which is fairly generic on the forums:
Code:
Function MergedCellsCount(rRange As Range) As Integer Application.Volatile
MergedCellsCount = rRange.MergeArea.Cells.Count
End Function
and then the code I have in the worksheet which has the word Apple in cell A70 is:
Code:
=IFERROR(MergedCellsCount(INDEX(D4:D51,MATCH("*"&$A$70&"*",D4:D51,0))),"")
Anyone got any ideas how to return a value which counts every instance in a column with merged cells based on a keyword like Apple?
Cheers,
Alex