--- loncom/interface/spreadsheet/Spreadsheet.pm	2004/03/31 05:24:00	1.37
+++ loncom/interface/spreadsheet/Spreadsheet.pm	2005/04/29 18:12:21	1.37.2.2
@@ -1,5 +1,5 @@
 #
-# $Id: Spreadsheet.pm,v 1.37 2004/03/31 05:24:00 albertel Exp $
+# $Id: Spreadsheet.pm,v 1.37.2.2 2005/04/29 18:12:21 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -571,7 +571,7 @@ sub SUMMAX {
     foreach (grep eval("/$mask/"),keys(%sheet_values)) {
 	push (@inside,$sheet_values{$_});
     }
-    @inside=sort(@inside);
+    @inside=sort {$a <=> $b} (@inside);
     my $sum=0; my $i;
     for ($i=$#inside;(($i>$#inside-$num) && ($i>=0));$i--) { 
         $sum+=$inside[$i];
@@ -598,7 +598,7 @@ sub SUMMIN {
     foreach (grep eval("/$mask/"),keys(%sheet_values)) {
 	$inside[$#inside+1]=$sheet_values{$_};
     }
-    @inside=sort(@inside);
+    @inside=sort {$a <=> $b} (@inside);
     my $sum=0; my $i;
     for ($i=0;(($i<$num) && ($i<=$#inside));$i++) { 
         $sum+=$inside[$i];
@@ -911,7 +911,8 @@ sub sett {
             $t{$cell}=~s/(^|[^\"\'])([A-Za-z]\d+)/$1\$sheet_values\{\'$2\'\}/g;
             $t{$cell}=~s/(^|[^\"\'])\[([^\]]+)\]/$1.$self->expandnamed($2)/ge;
         } elsif  ( $col  =~ /^[A-Z]$/  ) {
-            if ($formula !~ /^\!/ && exists($self->{'constants'}->{$cell})) {
+            if ($formula !~ /^\!/ && exists($self->{'constants'}->{$cell})
+		&& $self->{'constants'}->{$cell} ne '') {
                 my $data = $self->{'constants'}->{$cell};
                 $t{$cell} = $data;
             }