Hey there stranger!

Sign up to get access.

Count Merged Rows

About this Tutorial

Count the number of cells or rows in a merged cell. This is a quick little code you can add to your sheets with the onOpen code.

Video Transcript

0:00 This happens all the time where we're working in Google Sheets we have some times or some data in a sheet and we're going to merge rows based on how many of these correspond right so this is three rows that they all correspond to New York City and we're going to merge New York City in the case we might
0:19 be better off doing something like this but it's not always the same look and feel we may want to actually just merge the rows and have one city here now this looks fine I can see here three But if I do this for hundreds or dozens of rows even it's going to become a little bit unwieldy to count each 
0:40 and every one of these items when I really just want to know how many times did I merge this Vancouver?
0:48 Well, I made a app script that does this for you. Uh check out app script and you can see it here when it opens.
0:55 What we've done is create first we created an on open menu that this is going to be a menu right here this new menu and we're going to be able to access it.
1:02 But what does this row count do? We'll see what the row count simply does is take the variable rows wherever we're active so we're getting the active range the the selection that we're in and we're getting the number of rows dot get number rows.
1:16 We're saying in our spreadsheet that's active right now. Create a toast menu and show us how many rows there are have the text rows and then insert that number here.
1:27 So if we are one B2 this is only one cell we click up here row count and in the bottom right it'll save rows one.
1:36 But now we click on NYC where we merge three rows we're going to click new menu row count and immediately we see rows three.
1:44 And this works however many times we merge the cells. So let's merge those all of these into one. And go up to new menu row count and get nine rows.
1:56 There we go. So very quickly we've been able to create this little tool in our sheet that counts the merged rows.
2:02 Our counts a number of rows in a merge cell.