+ Reply to Thread
Results 1 to 4 of 4

Complicated Array Formula Question

  1. #1
    Registered User
    Join Date
    12-28-2006
    Posts
    3

    Complicated Array Formula Question

    I'll try and explain what I am doing. Any help would be appreciated...

    I have data that is imported into cells A1:A10 that can be positive, negative, or zero. Here is an example:

    A1=5
    A2=2
    A3=-2
    A4=0
    A5=3
    A6=-1
    A7=0
    A8=1
    A9=0
    A10=-3

    In cells C1:C10 I would like to see the following results based on the entries in A1:A10. All positives listed first, blank line, then negatives listed. Zero amounts are disregarded. This is what I would want the above to produce in cells C1:C10:

    C1=5
    C2=2
    C3=3
    C4=1
    C5=Blank
    C6=-2
    C7=-1
    C8=-3
    C9=Blank
    C10=Blank

    Thanks in advance,

    Sam

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Hi,

    Not exactly what you wanted. But thought I would get the ball rolling on this one. Will Leave C5 blank but leaves zero as blank but not at the bottom

    =IF(ISERROR(IF(OR(ROW()=5,LARGE($A$1:$A$10,ROW())=0)," ",LARGE($A$1:$A$10,ROW()))),"",IF(OR(ROW()=5,LARGE($A$1:$A$10,ROW())=0)," ",LARGE($A$1:$A$10,ROW())))

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Registered User
    Join Date
    12-28-2006
    Posts
    3
    Thanks VBA Noob! I appreciate you taking the time to address my question. That is very close to what I want. Hmmm, that is further along than I made it but I would really like to push those blanks to the end if possible. Again, thanks for your help!

    Sam

  4. #4
    Registered User
    Join Date
    12-28-2006
    Posts
    3
    This appears to work. Thanks for the help again.

    Formula in E1:E10

    =IF(A1>0,COUNTIF(A$1:A1,">0"),IF(A1<0,COUNTIF(A$1:A$10,">0")+COUNTIF(A$1:A1,"<0")+1,""))

    Formula in F1

    =MAX(E1:E10)

    Formula in C1:C10

    =IF(OR(ROWS(C$1:C1)>F$1,ROWS(C$1:C1)=COUNTIF(A$1:A$10,">0")+1),"",INDEX(A$1:A$10,MATCH(ROWS(C$1:C1),E$1:E$10,0)))

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1