Forum Discussion

Jeremy_Pats's avatar
Jeremy_Pats
Copper Contributor
Nov 12, 2021
Solved

Finding the 5 least numbers from cells with formulas

Hi everyone, I have the following challenge:

 

I am trying to get the smallest 5 numbers to be summed up from an array of cells. The challenge is that when I use formulas such as SUMPRODUCT or SMALL, I get an #NUM! or #VALUE! error. The cells in the array all have the following formula to get the desired number, =IF(G7>=80,"1",IF(G7>=75,"2",IF(G7>=70,"3",IF(G7>=65,"4",IF(G7>=60,"5",IF(G7>=55,"6",IF(G7>=50,"7",IF(G7>=45,"8",IF(G7>=1,"9",IF(G7>=0,"-"))))))))))

 

How can I get to sum up the 5 smallest numbers, above 0 without the error(s)? 

8 Replies

  • SergeiBaklan's avatar
    SergeiBaklan
    Diamond Contributor

    Jeremy_Pats 

    Depends what you'd like to sum. For such sample

    if small 5 from and you are on Excel 365 or 2021 it could be

    =SUM( SMALL( FILTER( G7:G17, G7:G17), SEQUENCE(5)) )

    If next column, it shall be calculated as numbers, not texts

    =LOOKUP( G7, {0,1,45,50,55,60,65,70,75,80}, {0,9,8,7,6,5,4,3,2,1})

     

      • Detlef_Lewin's avatar
        Detlef_Lewin
        Silver Contributor
        Double quotes around the numbers makes them text. Some functions ignore text (like SMALL()), and some throw an error.
    • Jeremy_Pats's avatar
      Jeremy_Pats
      Copper Contributor
      @Quaruple_Pawn, because of the double quotes, your formula was not working but as soon as I removed them, it worked like a charm.

      Thank you for the massive help!
    • Jeremy_Pats's avatar
      Jeremy_Pats
      Copper Contributor
      Hi OliverScheurich

      Thank you for the prompt response. I have tried your formula and it shows the #VALUE! error. If i press ctrl+shift+enter, it shows the #NUM! error.
      • OliverScheurich's avatar
        OliverScheurich
        Gold Contributor

        Jeremy_Pats 

        That' s surprising as it works in my spreadsheet.

        Can you attach a file of your spreadsheet where i can see the formula you entered and the range of data which you want to sum.

Resources