0

Conditional sorting

Hello, I need help on figuring out how to do a conditional sort.  I'm trying to do a conditional sort on serial no. where If the transaction type is not RELEASE, sort "After serial no." where Type = "To", else sort "Before serial no." where Type = "From".  This formula works: 

=NL("Rows","posted work order line",,"document no.",NP("Union",$E$14,$E$15,$E$16),"+work order date",$D$3,"+=if(nf(,""Transaction Type"")<>""RELEASE"",NL(""Last"",""posted work order line"",""After serial no."",""Document no."",nf(,""Document no.""),""Type"",""To""), NL(""Last"",""posted work order line"",""Before serial no."",""Document no."",nf(,""Document no.""),""Type"",""From""))","*")

However, I need to add more logic.  What I really need to do is if Transaction Type is not RELEASE, then sort "After Serial no." where Type = "To".  Then if Type is = RELEASE, and if "After serial no." is not zero where Type = "From", then sort on that, else sort on "Before Serial no." where Type = "From".  So I added the additional logic into the sort like below, but it doesn't work.  It returns #VALUE (Excel is unable to evaluate).

=NL("Rows","posted work order line",,"document no.",NP("Union",$E$14,$E$15,$E$16),"+work order date",$D$3,"+=if(nf(,""Transaction Type"")<>""RELEASE"",NL(""Last"",""posted work order line"",""After serial no."",""Document no."",nf(,""Document no.""),""Type"",""To"")," & "
if(nl(""last"",""posted work order line"",""After Serial No."",""Document No."",nf(,""document no.""),""Type"",""FRom"")<>0, NL(""Last"",""posted work order line"",""AFter serial no."",""Document no."",nf(,""Document no.""),""Type"",""From"")," & "NL(""Last"",""posted work order line"",""Before serial no."",""Document no."",nf(,""Document no.""),""Type"",""From"")))","*")

4 comments

Please sign in to leave a comment.