hello people, I'd like to count Cells that have values in a merged format, is this even possible? tnx indeed.
Book1.xlsx
hello people, I'd like to count Cells that have values in a merged format, is this even possible? tnx indeed.
Book1.xlsx
Welcome to forum... please explain how these are 19 and 14
Don`t care, take care...
Regards,
Mangesh
@mangesh.mehendale Thank you so much, sorry to post this thread before I introduced myself, will do asap.
imagine there were no merged cells in this sheet, and we wanted to count the duplicated values and also non duplicated in merged cells, that's what I'm after.
Vba Function:
merge_cell_count_cy.xlsm![]()
Public Function MergeCellCount(Rng As Excel.Range) As Long Dim Cell As Excel.Range Dim Count As Long Count = 0 For Each Cell In Rng If Not IsEmpty(Cell.MergeArea.Cells(1, 1).Value) Then Count = Count + 1 End If Next MergeCellCount = Count End Function
When cells are merged, only the upper left cell holds the value. COUNT is not counting cells, it is counting the number of cells with numbers; therefore, 10 not 19. You merged A5:A7 and entered 78 in the merged area, but only cell A5 is holding the 78 so count is one not three.
Ben Van Johnson
I know merging is not recommended at all, but I needed this for a lot of sheets that the end user works with and knows nothing about excel at all, I tried to unmerge the cells and entered the same value in them, but it's hard to work due to the users eyes, but I think I could use the cyiangou's VBA function to solve this. tnx anyways![]()
Last edited by 23-zeros; 08-04-2015 at 01:43 AM.
This also had me arguing for awhile, but 23-zeroes spec is exactly consistent with his expected result.
or 'count cells whose containing mergeareas have values entered'count Cells that have values in a merged format
Last edited by cyiangou; 08-04-2015 at 01:06 AM.
Based on the sample answers (19 and 14), this cannot be done with regular formulas. As Ben said a merged cell (of however many cells) becomes 1, so excel will count that sample as 10 and 5
1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
2. If your question is resolved, mark it SOLVED using the thread tools
3. Click on the star if you think someone helped you
Regards
Ford
A pleasure. An 'Add Reputation' to the left of my post would be good. Thanks!
(also mark as SOLVED in the thread tools at the top of the page)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks