Conditional highlighting the lowest 5 numbers out of 10 in a row of numbers

Can this be done?  I can do it in Excel but have not figured out how to do it in Numbers.
39 40  38 41  41  38  39  39  40  36

Or even simpler, if you don't want to fuss with adding extra columns and such, you can just select the cells with the numbers and click a button to color the lowest 5 numbers red. Six are colored here because of a tie:
SG
Copy this script into AppleScript Editor, select the cells, and click the green triangle 'Run' button:
--colors text of selected cells with lowest five values red
tell application "Numbers"
          set t to front document's active sheet's first table whose selection range's class is range
          set selectedCells to t's selection range
          set sortedNumbers to my sortNumbers(selectedCells's cells's value)
          set lowestFive to sortedNumbers's items 1 thru 5
          repeat with aCell in selectedCells's cells
                    if (aCell's value as string) is in lowestFive then
                              set aCell's text color to "red"
                    else
                              set aCell's text color to "black"
                    end if
          end repeat
end tell
to sortNumbers(theList)
          set oTIDs to text item delimiters of AppleScript
          set text item delimiters of AppleScript to ASCII character 10
          set theList to "" & theList
          set text item delimiters of AppleScript to oTIDs
          do shell script "echo " & quoted form of theList & " | sort --general-numeric-sort"
          set theList to paragraphs of result
end sortNumbers
--end of script
(NB: for VERY long lists of numbers, this would need modifying)

Similar Messages

  • Distinguishing the lowest test score in a while loop

    Hi,
    I am working on a program that collects a series of test scores from the user. The program should tabulate the scores and it should highlight the lowest score amongst the other test scores, but there within lies the problem for me. This is what my program looks like at this moment:
    import java.util.*;
    public class ArrayOfTestScores
        public static void main(String[] args)
            int[] testScore = new int[5];
            int count, max, min, next, number;
            int sum, average, lowScore, bottomScore;
            Scanner keyboard  = new Scanner(System.in);
            lowestScore = 0;
            sum = 0;
            System.out.print("Enter score for test 1: ");
            max = keyboard.nextInt();
            number = 1;
            count = 1;
            while(count<5)
                System.out.print("Enter score for test" + (number+1) +": ");
                testScore[count] = keyboard.nextInt();
                testScore[0] = max;
                min = max;
                next = testScore[count];
                if(next > max)
                    max = next;
                else
                    min = next;
                    if(next < min)
                        min = next;
                    else
                        max = next;
                sum = sum + testScore[count];
                min=lowestScore;
                number++;
                count++;
            bottomScore = lowScore;
            for(count = 0; count < testScore.length; count++)
                if(testScore[count]==bottom)
                    System.out.println("Test" + (count+1)+ testScore[count]+ "lowest score");
                else
                    System.out.println("Test" + (count+1)+ testScore[count]);
    }Here is a sample of what the output looks like:
    Enter score for test 1: 50
    Enter score for test 2: 70
    Enter score for test 3: 22
    Enter score for test 4: 90
    Enter score for test 5: 99
    Test 1: 50
    Test 2: 70
    Test 3: 22 lowest score
    Test 4: 90
    Test 5: 99
    If there is anyone out there who can assist me with this program, I would appreciate it tremendously.

    Here's part of your codeelse
                    min = next;
                    if(next < min)
                        min = next;
                    else
                        max = next;
                }So, first min is set to the same value as next. Then you have an if statement that tests to see if next is less than min. How can that ever happen if min=next?

  • I'm trying to add the lowest 4 out of 6 numbers in a column

    New to numbers and I'm trying to create a spreadsheet that adds the lowest 4 out of 6 numbers in a column.  I've made the spreadsheet with it adding all six numbers but haven't quite figured out the rest.  Any help or direction to a solution would be appreciated. 

    Heres's a solution that you might find interesting, not necessarily better:
    The first 5 rows are Header Rows...
    In one sense it's a more general solution since it doesn't matter how many numbers are in the input list. On the other hand, you run out of Header Rows at 5 , so if you want the sum of the first 5 or more numbers, you need a different layout.
    Jerry

  • PO in transaction ME21N, the condition tab in PO is greyed out

    Hi Experts,
    Pls help me out from this...
    When creating the PO in transaction ME21N, the condition tab in PO is greyed out.I am not able to enter the price. The price fields are greyed out.
    Any inputs on this will be highly rewarded.
    Regards
    Lakshmiraj

    Hi,..
    thanks a lot for the reply.
    yes  it is allowing.
    Moreover it is happening in production server . In development server everything is fine.

  • Can't figure out why colors don't totally change when you select type with curser? It looks like it has by looking at it, but when you highlight the area after the old color is still there. It happens with objects to. Driving me NUTZ. Help!

    Can't figure out why colors don't totally change when you select type with curser? It looks like it has by looking at it, but when you highlight the area after the old color is still there. It happens with objects to. Driving me NUTZ. Help!

    Select the text, and open the Appearance palette (Come on guys, text highlight is irrelevant, it happens to objects too says the OP), and see what's listed there.  For a simple text object, there should only be a line item "Type", followed by "Characters", and when double-clicked the Characters line item expands to tell you the stroke and fill color.  For a basic object, there should be a fill and/or stroke.
    What happens sometimes, is that you end up adding extra strokes/fills to objects or text, and the appearance palette is where that will be noted.  Especially when you are dealing with groups, and/or picking up a color with the eyedropper, you may inadvertently be adding a fill or stroke on top of something.  You can drag those unwanted thingies from the Appearance palette into its own little trash can.

  • How can i find out the last 5 numbers dialed without having the phone

    how can i find out the last 5 numbers dialed without having the phone

    log into your myverizon account,go to detail useage

  • I like the mail feature with one exception; I cannot figure out how to change the font size of incoming mail permanently.  And, when answering an email I have to highlight the first few words and zoom it so I can see what I am writing.  what am I missing?

    I like the mail feature with one exception; I cannot figure out how to change the font size of incoming mail permanently.  And, when answering an email I have to highlight the first few words and zoom it so I can see what I am writing.  what am I missing?

    You can type the email using what you set in preferences and then highlight the text and use command - minus sign (or command - + for larger) to reduce the size of the text.
    You can also type command - T and a window will appear allowing you to select fonts/sizes/color/ background highlight.
    The above works in Notes also. I haven't tried to do this in any other Apple application.
    For incoming emails, you can use the above to reduce font size, but I don't know of a way to permanently set the incoming font size to a default.

  • Pricing : Condition type value need tog get from the lowest of 4 other cond

    Hi,
    I have one requirement in one pricing procedure.
    I need to calculate condition value of one condition type from the lowest value of other 4 condition tyeps. These condition types values are not defined as a subtotal.
    So if I decide to write a formula on condition values, is there
    any way to select these values and choose the lowest of them?
    Please also advice if there is any other way such as condition exclusion
    or so?
    Thanks and regards,
    Anand

    Anand,
    As you have mentioned you can use condition exclusion for such a requirement.
    here is a detailed description of how you can achieve this: use the menu path IMG> Sales & Distribution> Basic Functions> Pricing> Condition Exclusion> Condition exclusion for group of conditions.
    When you execute this IMG acitivity you get a window with three options
    1.Define Condition Exclusion Groups
    2.Assign condition types to the exclusion groups
    3.Maintain condition exclusion for pricing procedures
    We will use these three options one by one, we start with the first
    1. Define an exclusion group, lets say EX01 and give a description
    2 Assign the four condition types that you want to compare to this exclusion group under this option
       lets say EX01 ZK01
                   EX01 ZK02
                   EX01 ZK03
                   EX01 Zk04
    3. under this third step, select the pricing procedure that you are working on and from the left margin click on 'Exclusion'. click on 'New Entries' and make the following entries (example)
             Sno.   Cpr         ExGr1
              10      A            EX01                leave ExGr2 blank, Save your entries
    Check if your purpose has been met or not. Do give your feedback
    Regards,
    PATHIK

  • How can i hightlight in excel 3 numbers in a column then skip one, and highlight the next?

    how can i hightlight in excel 3 numbers in a column then skip one, and highlight the next?
    Example: Column A
    highlight      3
    highlight      4
    highlight      5
    skip            6
    highlight      7

    hold down the cmd (⌘) key while selecting them.

  • Hi, I can't figure out why I can't render on my timeline. I highlight the segment hit "Apple-R" and it gives me a weird message about "conforming HDV video...." and the bar goes as far as 60-66% and holds there forever. It never renders even partially.

    Hi, I can't figure out why I can't render on my timeline. I highlight the segment hit "Apple-R" and it gives me a weird message about "conforming HDV video...." and the bar goes as far as 60-66% and holds there forever. It never renders even partially.

    Yes, I know. I have been working with HDV for some time. I am wondering why it doesn't render when it needs to.. the red and bright-green lines are above, and I've set the render settings such that ANYTHING I highlight and hit apple-R will render. But its not rendering at all.

  • I've been trying to get the spreadsheet in numbers to be portrait rather than landscape, but cannot seem to be able to work out how. Maybe it's not possible, does anyone know how?

    I've been trying to get the spreadsheet in numbers to be portrait rather than landscape, but cannot seem to be able to work out how. Maybe it's not possible, does anyone know how?

    Open the inspector by selecting the menu item "View > Show Inspector", then click the "Sheet" segment at the top, then click the landscape button in the "Page Layout" section:
    I suggest you download the free Users Guide from Apple.  Here's the link:
    http://support.apple.com/manuals/#productivitysoftware

  • How to have a condition with the outer join

    Hi, I'd like to know if, inside a report, there's a way to create a condition which include in some way an outer join.
    So, I have 2 custom folders:
    Tickets with 2 fields: Ticket_id, Inventory_item_id, category_id and iptv_sumptom
    Hierarchy with 4 fields: Symptom, Inv_item_id, Category_id and Group
    These 2 folders are joined in this way
    Tickets.inventory_item_id = Hierarchy.inv_item_id (+) AND Tickets.category_id = Hierarchy.category_id (+) AND Tickets.iptv_sumptom = Hierarchy.Symptom (+)
    Now, from the report I have a parameter based on the field Group to restrict dataset of the tickets.
    ...but when I choose a group and I run the report, the conditions inside the plsql query generated is like this
    WHERE (Tickets.inventory_item_id = Hierarchy.inv_item_id (+) AND Tickets.category_id = Hierarchy.category_id (+) AND Tickets.iptv_sumptom = Hierarchy.Symptom (+)) AND Hierarchy.Group = 'A'
    where the last condition is WITHOUT outer join !
    I need to have also the outer join on the Hierarchy.Group: AND Hierarchy.Group (+) = 'A', but from the Administrator I don't want to add another join with (+) for the Group. From Plus I didn't find any way to write (+).....
    Anybody knows another method or workaround to have also a filter (the condition Hierarchy.Group = 'A') with an outer join ?
    Thanks in advance
    Alex

    Hi,
    A workaround can be either use new objects or modify the existing ones to avoid the outer join.
    In order to do that you can add a dummy record to each custom folder and then join by it.
    For example if you will add to the
    Tickets will be:
    select Ticket_id, Inventory_item_id, category_id, iptv_sumptom
    from......
    union all
    select -1,-1,-1,'Some value' from dual
    And hierarchy will be:
    select Symptom, Inv_item_id, Category_id ,Group
    from......
    union all
    select 'Some value',-1,-1,'Some value' from dual
    Now you can create a full join between them without the need to outer join.
    Hope it will help
    Tamir

  • Conditional Highlighting multiple cells

    I've created a schedule for specific actions performed. There are over 200 actions and when I use one, it needs to be "unavailable" for the following 3 entries. If I can, I want to check the box on that cell and have it auto highlight that cell and the following three cells after so I can black it out until it's "available" again. Is there a way to do this?
    EDIT: Also, if there is a way to auto check those 3 subsequent cells, I'm good with that too.

    Like quinn's use of OR!
    AppleScript is good at conditional highlighting of ranges.  For example I get this when running the script below. (The actual table is formatted as checkboxes but shows here as TRUE and FALSE).
    Week
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    Song 1
    FALSE
    TRUE
    FALSE
    FALSE
    FALSE
    TRUE
    FALSE
    FALSE
    FALSE
    FALSE
    Song 2
    FALSE
    FALSE
    FALSE
    FALSE
    FALSE
    FALSE
    TRUE
    FALSE
    FALSE
    FALSE
    Song 3
    TRUE
    FALSE
    FALSE
    FALSE
    FALSE
    FALSE
    FALSE
    FALSE
    FALSE
    FALSE
    Song 3
    FALSE
    FALSE
    FALSE
    FALSE
    TRUE
    FALSE
    FALSE
    FALSE
    FALSE
    TRUE
    Copy the script, paste into AppleScript Editor, click once in the table (this is important or the script won't know which table you mean), and click the green triangle run button. 
    This works with Numbers 3.  Numbers 2 would require changes in the script. Change orange to whatever you want.
    SG
    The script:
    property firstCheckCol : 2
    property firstDataRow : 2
    tell application "Numbers"
      set t to front document's active sheet's first table whose selection range's class is range
      set vv to t's rows's cells's value -- place values in "list of lists"
      set numCols to count vv's item 1
      repeat with r from firstDataRow to count vv
      repeat with c from 3 to numCols
      tell vv's item r
      try
      if its item (my max(c - 1, firstCheckCol)) ¬
      or its item (my max(c - 2, firstCheckCol)) ¬
      or its item (my max(c - 3, firstCheckCol)) ¬
      is true then
      set t's row r's cell c's background color to "orange"
      end if
      end try
      end tell
      end repeat
      end repeat
    end tell
    on max(x, y)
      if x > y then return x
      return y
    end max

  • Getting the lowest and highest dates from a column

    <Praise>Numbers is absolutely incredible. Kudos to the Apple team. From the first time I've used it, it has enabled this average spreadsheet user to create awe-inspiring layouts from average data. I'm extremely excited to see where Apple brings </Praise>
    What I am trying to do though is this. I have a column with dates in it. I'm trying to get the lowest and highest dates in that column for a report. For instance, "Date range between 7/1/2007 and 9/11/2007".
    Any help would be very much appreciated

    Let me also pose this. I've been asked to create a two date ranges for this from the same data. This report will need to be updated every two months. Is there a way to specify the spreadsheet to select only rows with a date between X and Y for processing?
    Or, more likely, is there a way to access a cell name by reference from another field? Such that I have a "Current From", "Current To", "Historic From", and "Historic To" column. The value of these fields could be references to a row number that has the beginning and ending date, so that it selects all of the rows in between.
    So I would have something like SUM(SourceSheet :: SourceTable :: A{CurrentTable :: A2} : SourceSheet :: SourceTable :: A{CurrentTable :: A3}) where CurrentTable A2 and A3 are "2" and "6" for rows A2:A6. Is this even possible? Hopefully I'm overcomplicating it and there's a magical function out there that I've missed.

  • Conditional highlighting using a formula

    In Word for Mac, we can highlight cells based on a formula. Is there a way to get the same in Numbers,too?

    Hi Naikosen,
    You are correct, we can't put a formula directly into a highlight rule. It is possible to get the same result.
    It is so frustrating to me that screenshots are currently problematic. I wish I knew what was the problem- it has been getting worse in my experience.
    Let me try to describe my screen shot.
    Data Table is the table you currently have.
    Highlight Table is a table you create that is a single cell, 3 Data Table cells wide. When it is dragged over the Data Table it will match the cells you want highlighted. Set the text color to white in this cell.
    The formula in this cell is
    =IF(data::$A1:$C1=0,"T","F")
    Conditional highlighting sets the fill and text to red using a Custom Style. If you need help finding the Conditional Highlighting sidebar let me know.
    Text is:
    T
    Custom Style is the last offering in the drop down.
    Set fill to red, set text to red.
    --Here is where I paused and checked to see if things worked. Make an entry in one of your data table cells, the highlight table should turn red. If ok, then continue.
    Drag the highlight table directly over the three cells in the Data Table you want to highlight.
    Send the highlight table to the back with Menu>Arrange>Send to Back.
    Avoid dragging the tables.
    Let me know if anything is not clear.
    quinn

Maybe you are looking for

  • Problems with images

    Hi there everyone, I have an Applet that i am developing that uses lots of images. I use applet viewer to test it and it is working fine in that - but when I view in Firefox or IE none of the images are displayed! No errors are output and I can't fig

  • How do you monitor required JAR(s) being downloaded?

    Hi there, I'm currently re-developing an existing signed applet (Swing / 1.4) to offer advanced image manipulation features. As a result there is a massive increase in the size of download and the amount of JARs to be downloaded from 1 (app 50kb) to

  • Quicktime error: not a valid windows 32 programme!!!

    i have been trying to download quicktime wit futile efforts.. it's apparantly not a windows.exe programme! witout this the iTunes is not installing as well..

  • Component Based on HTTPService

    Is it possible to create a new MXML component based on HTTPService? Thank you.

  • 2010 or 2011 battery in Macbook pro 2009 13"??

    I want to put a 2010 or 2011 macbook pro battery in my 13" macbook pro 2009 MB991LL/A. Is this possible? If so could you point me to the correct battery and model number? Also maybe an e-bay link to said battery