Nov 23rd, 2010, 08:30 AM
#1
Excel 2003 - Merged Cells Size Restriction When Sorting
I suspect the answer to this is No, but I want to check anyway.
I have a report that has been dumped to Excel and formatted using Merged Cells.
I need to sort a number column in this report, but it won't let me because the size of the merged cells do not match. I tried unmerging the cells, but that totally messes up all the formating.
Is there any slick trick way around the merged cells size restriction with respect to column sorting?
Nov 23rd, 2010, 09:09 AM
#2
Re: Excel 2003 - Merged Cells Size Restriction When Sorting
I suspect the answer to this is No, but I want to check anyway.
Yes there is a way. Using VBA code... Would that help?
Last edited by Siddharth Rout; Nov 23rd, 2010 at 09:13 AM .
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear :
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
Nov 23rd, 2010, 09:17 AM
#3
Re: Excel 2003 - Merged Cells Size Restriction When Sorting
Originally Posted by
koolsid
Yes there is a way. Using VBA code... Would that help?
I could put a button on the report, run some code, and then just delete the button, so yeah...if the VBA code did what I needed, and maintained the existing formatting, then that should work.
What slick trick do you have up your sleeve?
Nov 23rd, 2010, 09:19 AM
#4
Re: Excel 2003 - Merged Cells Size Restriction When Sorting
Originally Posted by
Hack
What slick trick do you have up your sleeve?
Ha Ha
1) Put the values of let's say Col "A" in an Array
2) Sort the array
3) Put them back
Lemme know if you want an example?
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear :
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
Nov 23rd, 2010, 09:37 AM
#5
Re: Excel 2003 - Merged Cells Size Restriction When Sorting
Well, I can do that...but I have data in columns A through I
Colums D,E,and F are merged as are J,K,L and M
C: is a dollar column
A: is a text column which corresonds to the dollar amount in column C:
I need C: sorted in descending order, but it has to maintain its relationship with the rest of the columns so just sorting the one column would kind of mess things up.
I can remove all sensitive information and attach a generic example if you want.
Nov 23rd, 2010, 09:44 AM
#6
Re: Excel 2003 - Merged Cells Size Restriction When Sorting
I can remove all sensitive information and attach a generic example if you want.
Perfect
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear :
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
Nov 23rd, 2010, 09:53 AM
#7
Re: Excel 2003 - Merged Cells Size Restriction When Sorting
I need "Drug Payments" sorted in descending order.
Thanks...if you can pull this off you will be on my Christmas Card List
Attached Files
Nov 23rd, 2010, 10:31 AM
#8
Nov 23rd, 2010, 11:39 AM
#9
Nov 23rd, 2010, 11:47 AM
#10
Re: Excel 2003 - Merged Cells Size Restriction When Sorting
Give me 15 mins... I think I know what the problem is...
Sid
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear :
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
Nov 23rd, 2010, 11:59 AM
#11
Re: Excel 2003 - Merged Cells Size Restriction When Sorting
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear :
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
Nov 23rd, 2010, 12:20 PM
#12
Re: Excel 2003 - Merged Cells Size Restriction When Sorting
Originally Posted by
koolsid
Update the Zip file
Update it with what?
Nov 23rd, 2010, 12:21 PM
#13
Re: Excel 2003 - Merged Cells Size Restriction When Sorting
My Bad... I replaced the zip file (wanted to say updated the file)
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear :
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
Nov 23rd, 2010, 12:30 PM
#14
Re: Excel 2003 - Merged Cells Size Restriction When Sorting
Hmmm...the drug name gets sorted, but the drug payment does not.
Nov 23rd, 2010, 12:31 PM
#15
Re: Excel 2003 - Merged Cells Size Restriction When Sorting
5 mins... let me recheck
Edit:
How stupid of me... Hmph!!!! I have Updated the Zip File
Last edited by Siddharth Rout; Nov 23rd, 2010 at 12:40 PM .
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear :
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
Nov 23rd, 2010, 12:56 PM
#16
Re: Excel 2003 - Merged Cells Size Restriction When Sorting
All of the columns sort together, but as you can see the numbers are not in order.
Maybe this is an Excel thing.
Attached Files
Nov 23rd, 2010, 12:59 PM
#17
Re: Excel 2003 - Merged Cells Size Restriction When Sorting
What is your sort criteria?
DRUG NAME - Descending
and then? (you can suggest Two more)
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear :
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
Nov 23rd, 2010, 02:28 PM
#18
Re: Excel 2003 - Merged Cells Size Restriction When Sorting
The user wants the drug payment amount sorted descending as criteria 1 and drug name goes with the payment amount as do all the rest of the columns.
I'm thinkin' I might have been right and this just isn't gonna happen.
I'll play around with it a bit.
Nov 23rd, 2010, 02:30 PM
#19
Re: Excel 2003 - Merged Cells Size Restriction When Sorting
I'm thinkin' I might have been right and this just isn't gonna happen.
Hack, Excel gives you 3 criteria to sort on. based on your above query, I had sorted it only on 1 criteria i.e the drug name. Can you tell me the third one?
1st is drug payment amount
2nd is drug name
Which is the 3rd?
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear :
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
Nov 24th, 2010, 05:44 AM
#20
Re: Excel 2003 - Merged Cells Size Restriction When Sorting
This code takes under 0.7 second on my PC (and it won't cost you a cent. )
vb Code:
Sub SortMerge()
Dim r1 As Long
Dim r2 As Long
Dim t As Single: t = Timer
With Sheet1
On Error Resume Next
r1 = WorksheetFunction.Match("DRUG NAME", .Columns(1), 0)
If r1 = 0 Then MsgBox "Header ""DRUG NAME"" not found.": Exit Sub
r2 = WorksheetFunction.Match("GRAND TOTAL", .Columns(1), 0) - 2
If r2 = 0 Then MsgBox """GRAND TOTAL"" not found.": Exit Sub
On Error GoTo 0
Application.ScreenUpdating = False
With .Range("A" & r1 & ":M" & r2)
'-- need to unmerge before sorting
.UnMerge
'-- don't care about DRUG NAME column: sort by "DRUG PAYMENTS" only
.Sort Key1:=.Cells(1, 3), Order1:=xlDescending, Header:=xlYes
'-- re-merge across
.Columns("A:B").Merge Across:=True
.Columns("C:F").Merge Across:=True
.Columns("I:M").Merge Across:=True
End With
Application.ScreenUpdating = True
MsgBox "Done!" & vbCrLf & Format(Timer - t, "0.000") & " secs."
End With
End Sub
Dec 4th, 2010, 07:55 AM
#21
Re: Excel 2003 - Merged Cells Size Restriction When Sorting
I feel you gave up too soon!
What you want is absolutely achievable. See post 19
Sid
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear :
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width