+ Reply to Thread
Results 1 to 6 of 6

Need to Display last 3 numbers from selection of 10 cells - without zeroes

  1. #1
    Registered User
    Join Date
    05-24-2013
    Location
    Oxford, England
    MS-Off Ver
    Excel 2010
    Posts
    8

    Need to Display last 3 numbers from selection of 10 cells - without zeroes

    I have 10 columns into which the numbers 1 to 4 (based on grades from elsewhere) are called into. The right hand columns may not yet have data in them and are therefore showing zero. The same number can appear more than once. I would like to show the last 3 (or fewer if less than 3) of these in a single cell in Column 11. For instance 1, 1, 2, 3, 2, 0, 0, 0, 0 ,0 would become 232; 1, 4, 0, 0, 0, 0, 0, 0, 0 ,0 would become 14; 1, 1, 2, 3, 2, 4, 3, 1, 2 ,3 would become 123.

    Are you able to help please?

  2. #2
    Valued Forum Contributor Lemice's Avatar
    Join Date
    04-13-2013
    Location
    Somewhere.
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: Need to Display last 3 numbers from selection of 10 cells - without zeroes

    Hello and welcome to the forum,

    One direct and rough way to do this is by using this Array formula
    Please Login or Register  to view this content.
    Assuming you have ten random one-digit number from A1 to J1, paste that formula on K2.

    Note that because it is an Array formula, you will need to confirm with Ctrl-Shift-Enter, not just Enter. A way to do this is that after you paste the formula on K2, click on the formula bar (to edit it), then hold Ctrl-Shift and hit Enter. If you see the formula being wrapped inside a { } then you did it right.
    (copy pasta from Ford)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools

    Regards,
    Lem

  3. #3
    Registered User
    Join Date
    05-24-2013
    Location
    Oxford, England
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Need to Display last 3 numbers from selection of 10 cells - without zeroes

    First class response - resolved the issue with which I have been battling all day!

    Many thanks.

  4. #4
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Need to Display last 3 numbers from selection of 10 cells - without zeroes

    Here's another solution, again, this is an array

    =INDEX($A1:$J1,MATCH(2, 1/(A1:J1<>0))-2) &INDEX($A1:$J1,MATCH(2, 1/(A1:J1<>0))-1) & INDEX($A1:$J1,MATCH(2, 1/(A1:J1<>0)))

    NOTE: Mine messes up if there are less than 3 values, might need an IF in there to catch that.
    Last edited by ChemistB; 05-24-2013 at 09:35 AM.
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  5. #5
    Valued Forum Contributor
    Join Date
    10-29-2012
    Location
    Mojokerto,Indonesia
    MS-Off Ver
    Excel 2007
    Posts
    554

    Re: Need to Display last 3 numbers from selection of 10 cells - without zeroes

    =right(trim(substitute(sumproduct((a1:j1)*(10^((columns(a1:j1)-column(a1:j1))))),0,"")),3)

  6. #6
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Need to Display last 3 numbers from selection of 10 cells - without zeroes

    Another arrayed formula

    =IFERROR(OFFSET(A1,0,MATCH(2, 1/(A1:J1<>0))-3),"") & IFERROR(OFFSET(A1,0,MATCH(2, 1/(A1:J1<>0))-2),"") & IFERROR(OFFSET(A1,0,MATCH(2, 1/(A1:J1<>0))-1),"")

    Hmmmm, seems there's more than one way to solve an Excel problem. Who'd a thunk?

+ 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