Thank you for being a valued part of the CNET community. As of December 1, 2020, the forums are in read-only format. In early 2021, CNET Forums will no longer be available. We are grateful for the participation and advice you have provided to one another over the years.

Thanks,

CNET Support

General discussion

Multiple title lines in Excel

Apr 6, 2007 12:27PM PDT

I'm trying to create an Excel spreadsheet with 3 rows of "titles". There are three "Major Divisions" which I've named in Row 1 and merged the cells into those three big cells. There are several "Minor Divisions" under those, in Row 2, and I've merged those cells as well. Lastly, in Row 3, each of the 43 individual columns has a title for the specific type of data that goes there. I've frozen the panes for the top 3 rows so that they will scroll with me throughout the 200+ rows of data.

My problem is that this arrangement prevents me from sorting any of the columns in ascending or descending order. I get an error message that says "This operation requires the merged cells to be identically sized." I don't know which merged cells it is specifically talking about. I've tried completely unmerging all cells in the document, and that resolves the error message BUT when I sort a column, it also sorts all three title rows into the middle of the data - plus, unmerging the cells ruins the title layout since I can no longer center the major and minor divisions over the proper columns.

I guess my question boils down to: how do I get excel to ignore the top three rows when I sort? And to leave them at the top when I sort? Highlighting the data to be sorted is not practical due to the size of the spreadsheet and frequency of sorting.

Thanks in advance for any help!

Discussion is locked

- Collapse -
Time for a new title line?
Apr 7, 2007 12:59AM PDT

What some want is multiple lines of text in a cell. The trick to this is that if you want to add a line break within a cell, press Alt + Enter, instead of just Enter.

Once the user understands this, they can move to a simpler single cell title line.

Bob

- Collapse -
Negative
Apr 7, 2007 1:39AM PDT

That's not really what I'm after. I've taken a screenshot of the spreadsheet and linked it below to better illustrate what I'm doing. You can see the three rows of title headings, and perhaps get a better idea of why I need three separate rows of titles rather than one row with multiple lines of text.

http://img142.imageshack.us/img142/8641/excelcl9.jpg

- Collapse -
I see Row 1 could be in your Page Title in...
Apr 7, 2007 1:48AM PDT

Print options. I could also fix this by not changing that cell width but I'll decline to provide a step by step here.

There are ways to fix this. You only need to find the method acceptable to you.

Bob

- Collapse -
Uh
Apr 7, 2007 3:35AM PDT

Thanks for the dubious help. :-/ No offense, but I didn't go to the trouble of registering here and seeking help just to be told that I can figure this out on my own. I've already spent hours trying to figure it out on my own, and failed. I'm out of ideas and not looking to waste more time on this problem.

As I said previously, there are 3 Major Divisions (Pre-operative variables, Intra-operative variables, and Post-operative variables), so I can't simply make "Intra-operative variables" the page title. Note that in the image, we're starting with Column S - there is a huge chunk of data to the left, and another huge chunk to the right, of what you see in the image.

- Collapse -
Yup.
Apr 7, 2007 4:02AM PDT

It's all volunteers here. Just so you know.

I see in Row B you found a way to use the same row count yet get your text where you want. You could use that in Row A so you can get it over with. OR move that title to page title. Your choice here.

The solution is ultimately your choice but it can be solved.

Bob

- Collapse -
Nope...
Apr 7, 2007 5:23AM PDT

"I see in Row B you found a way to use the same row count yet get your text where you want."

Not true, those cells are merged and the text centered in the resulting large cell, just like in Row 1, so that is not my solution. You keep saying "the solution is my choice" but you've not offered me a solution and I don't have one of my own. I appreciate that you're trying, but what I need is for someone to say, "Try doing _____, _______, and ______." Doing stuff that, by your own admission, I've already done, is not going to solve it.

- Collapse -
Good luck then.
Apr 7, 2007 5:31AM PDT

I tried it here and it appears to work as I noted. Maybe someone else will explain with other words so you can understand it. At least you have the option of the page header title to sub in for row A but you dismissed it.

It appears you need someone to come over to work this for you. Do you have an IT staffer to call in?

As to step by step I see no reason to do that since you appear to have the skill level to use or try the page header solution, unless you are calling that a non-solution. Here it looks the same on the print out.

Bob

- Collapse -
Just select the area you want sorted, not the headers
Apr 7, 2007 6:03AM PDT

Just select the area you want sorted, not the headers.
Then use the Data>Sort command.

If you are asked if you want to expand the selection, because there is data next to your selection, just select "Continue with the current selection"

In the sorting windows you will have to use the sorting named by Column letters (like A, B C ... AA, AB, etc.)
and you can then add additional secondary, and third sorts with the "Then by" settings.

Ensure that the "My data range has" is to "No header row"
(else the top row of your selection will not move, if needing to be sorted also.)

- Collapse -
Won't work
Apr 17, 2007 2:07AM PDT

As I said previously, the data range to be sorted contains literally thousands of cells and highlighting that huge mess every time I need to sort is highly impractical.

- Collapse -
re: highlighting that huge mess every time
Apr 17, 2007 5:11AM PDT

You are a very dismissive person, you seem to want to dismiss a practical solution before you really try it. I have read that you now have a solution to your problem, courtesy of Kees Bakker. Well good, I am glad for you. Now you have added something to your table that you have to hide. Not the way I would have gone, but if it works for you, fine.

As for highlighting this "huge mess" it is as easy as typing x:y
Where x is the top left corner of your range, and y is the bottom right corner of the range.
All you do is click in the cell reference area (the box on the left end of the Formula Bar) and type in that x:y and press Enter.

For example, if the corners of the data needing to be sorted are D5 and K24 you just type in D5:K24 and press Enter, and Bingo! that area is highlighted!
If that area is often needing to be selected, you could even name that area a name you like, perhaps something like "Biggie" and then any time you want to select that defined area just go to the cell reference pull-down arrow and select "Biggie"

It is pretty simple. And sorting that selected area is still as simple as I have already described.

But, then again, you already have something that works for you, so I guess there is no reason to learn something new.

- Collapse -
In cases like this ...
Apr 7, 2007 8:19AM PDT

I just add an empty row (which I can make very small or even hide) between row 2 and row 3. I've a 4-line header then, and if I select any cell in row 5, then choose Data>Sort it seems to work satisfactory: all the 4 header rows stay where they are, row 4 is recognized as containing the column titles to sort and the lines 5 and below are sorted.

This is Excel 2000. I don't know if higher versions behave the same.

If it's a requirement to have the visible rows numbered as 1,2,3,4,5 (and not as 1,2,4,5,6) or to have exactly 3 header rows (in stead of 4, one of which is invisible) you'll have to write a macro. But if the requirements aren't so strict, this seems to work.

Hope this helps.


Kees

- Collapse -
Interesting...
Apr 17, 2007 2:09AM PDT

I will give this a try and report back. Thanks for the idea.

- Collapse -
Yay
Apr 17, 2007 4:22AM PDT

worked like a charm. THANKS!

- Collapse -
(NT) You're welcome. Thanks for letting us know.
Apr 17, 2007 7:26AM PDT
- Collapse -
On a related note...
Apr 17, 2007 5:56PM PDT

Hi, just found this thread while googling a similar problem.

I have been using the 'blank line' to solve this problem for years, so I can vouch that it works. However, I'm currently working on a sheet that REFUSES to sort the top row of the actual data - it doesn't matter which cell I select, if I use the A-Z sort icon, it sorts everything beautifully EXCEPT the very top row of data (which is line 4 in this case, line 1 being a heading, line 2 being totals of their respective columns, & line 3 being blank).

I don't remember seeing this happen before, so it is possible I've inadvertently changed a preference or some attributes somewhere.

Any ideas?!

- Collapse -
Hmm
Apr 18, 2007 12:02AM PDT

Obviously I'm not expert since I needed help with it myself, but maybe try inserting another blank line and hiding it?

- Collapse -
Thanks
Apr 18, 2007 11:22AM PDT

Thanks, but it didn't work.

For now I've copied and pasted (values and number formats only) into a new worksheet, which has done the trick. So it is obviously some strange attribute that somehow attached itself to that particular row of data, preventing it from sorting like the other rows.

Would have been nice to figure out what the heck it was, but what can you do.

- Collapse -
re: but what can you do
Apr 18, 2007 12:04PM PDT

Well, you could put the file 'out there' where we can retrieve it, and look it over, to figure it out for you.