#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Sorting

I tried looking through Google but to no avail. I'm
trying to automatically sort a range of data containing
two columns using VBA not the sort under DataSort. The
cell I'm want to sort on is text (company names) and is a
formula based on information on another worksheet. My
dilema is that when I sort this way
..Range("a34:b202").Sort Key1:=.Range("a34"),
Order1:=xlAscending
the results come out alphabetically but if there are
blank cells between the last company and A202 the blanks
are at the beginning and I need them at the bottom. Is
there a way to sort with putting the blanks at the end?
Could I maybe add INDEX or something to the formula to
have it do it? the fomula I use is:
{=IF(ISNA(INDEX('Priced BOM'!$W$3:$W$1010,MATCH(0,COUNTIF
($A$33:A33,'Priced BOM'!$W$3:$W$1010),0))),"",INDEX
('Priced BOM'!$W$3:$W$1010,MATCH(0,COUNTIF
($A$33:A33,'Priced BOM'!$W$3:$W$1010),0)))}
Thanks for all your help
Joe
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 280
Default Sorting

I might consider putting "zzzzzzzzzzzzzzzz"s (or other useful but unique
values) in the blank cells programatically, sort, then remove the
"zzzzzzzzzzzzzzzzzz"s using a replace the "zzz...." with a null string.

Or use a helper column filled with formulas and/or values that better
represents the sort I want, sort on the helper column, then drop it.

"Joe Gieder" wrote in message
...
I tried looking through Google but to no avail. I'm
trying to automatically sort a range of data containing
two columns using VBA not the sort under DataSort. The
cell I'm want to sort on is text (company names) and is a
formula based on information on another worksheet. My
dilema is that when I sort this way
.Range("a34:b202").Sort Key1:=.Range("a34"),
Order1:=xlAscending
the results come out alphabetically but if there are
blank cells between the last company and A202 the blanks
are at the beginning and I need them at the bottom. Is
there a way to sort with putting the blanks at the end?
Could I maybe add INDEX or something to the formula to
have it do it? the fomula I use is:
{=IF(ISNA(INDEX('Priced BOM'!$W$3:$W$1010,MATCH(0,COUNTIF
($A$33:A33,'Priced BOM'!$W$3:$W$1010),0))),"",INDEX
('Priced BOM'!$W$3:$W$1010,MATCH(0,COUNTIF
($A$33:A33,'Priced BOM'!$W$3:$W$1010),0)))}
Thanks for all your help
Joe



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorting Values Without Sorting Formulas SBX Excel Discussion (Misc queries) 2 April 12th 09 11:17 PM
Automatic sorting (giving max and min) based on custom sorting lis Joe Lewis[_2_] Excel Worksheet Functions 4 November 23rd 08 05:12 AM
Sorting VLookup vs Sorting SumProduct Lauren Excel Discussion (Misc queries) 1 August 21st 07 12:19 AM
Sorting: Sorting by the First Character dzuy Excel Discussion (Misc queries) 2 June 22nd 06 08:27 PM
Sorting ListBox results or transposing ListBox values to other cells for sorting Rob[_8_] Excel Programming 1 July 9th 03 04:35 AM


All times are GMT +1. The time now is 01:27 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"