Conditional inclusion of column cells based on value in another column?

I was wondering if something like the following is possible -- I've looked through the forums and Numbers user guide but can't figure it out:
Suppose I have a column A of sales figures, and columns B and C which basically have different attributes (say, color (yellow or green), size (small or large), and material (cotton or polyester)).
I want to run basic statistics on various combinations: e.g. all yellow items regardless of size, all green cotton items regardless of size, all large yellow items regardless of material, etc.
I want to be able to specify something like this:
'Compute the average of every cell in column A where column B=="green" and column C=="large"'
Is there a good way to go about doing this? Would I want to attack the problem using categories, sorting, and multiple tables? Or is there a way to conditionally include cell values from a range based on the value of that row's cell in another column?
Thanks for any help.

All I can think of to solve the quartile and median functions is to have another table of the same size as your original table that gets populated with just the items that match. Then you can do the quartile and median (and average) on that table. It's a one-at-a-time affair; you can only do one selection of size, color, and/or material at a time but you can get the median, mean, and quartiles of it. Of course, you could have multiple copies of this second table if you want to do more than one comparison at a time.
In the attached file, unhide the hidden rows in Table 2 to see the formulas that do all the work.
[files.me.com/pwb3/6hobt0.numbers.zip]
Message was edited by: Badunit
Message was edited by: Badunit

Similar Messages

  • Color a column based on value in another column in tableview

    I am using a tableview iterator to display data in a bsp page. I want to color a cell in particular column (column 4), when a value in another column (column 2) on that same row is greater than 20. I can color the cell in column 2 but am not able to color the cell in column 4. How can I accomplish this?
    This is what I have. Looks like val1 is losing it's value.
    CASE p_column_index.
        WHEN 2.
          ASSIGN p_row_data_ref->* TO <row>.
          ASSIGN COMPONENT 'ZTGT' OF STRUCTURE <row> TO <col>.
          VAL = <col>.
          IF VAL GT '20'.
            val1 = p_row_index.
            p_style = 'celldesign:CRITICALVALUE_DARK'.
          ENDIF.
        WHEN 4.
            if p_row_index = val1.
              p_style = 'celldesign:CRITICALVALUE_DARK'.
            endif.
        WHEN OTHERS.
    do nothing
      ENDCASE.

    The reason val1 is "loosing its' value" is presumably because you have defined it in the method as a local variable. So each time you call the RENDER_CELL_START method it is is newly initialised. So if you make this an instance attribute it will retain its' contents across method calls.
    Cheers
    Graham Robbo

  • Update one column while getting the value in another column

    Is it possible to in one single SQL statement update two columns in a table while at the same time obtaining the value of another column, on the same row, in the same table, and independently (that is, the update of the columns has nothing to do with the data that I want from another column)*?* Of course, I can do this in two operations, one being a "select" and the other one being an "update", but since I am in the same table and even on the same row, is it really necessary to make TWO database calls? That's why I want to combine the the two SQL-statements, for reasons of presumed effiency.

    jsun wrote:
    Is it possible to in one single SQL statement update two columns in a table while at the same time obtaining the value of another column, on the same row, in the same table, and independently (that is, the update of the columns has nothing to do with the data that I want from another column)*?* Of course, I can do this in two operations, one being a "select" and the other one being an "update", but since I am in the same table and even on the same row, is it really necessary to make TWO database calls? That's why I want to combine the the two SQL-statements, for reasons of presumed effiency.Two statements != two database calls.
    At least not in terms of SQL.
    JDBC requires a 'statement' but in SQL (depending on the data source) that can include multiple statements. An obvious example of this is a stored proc but there are other ways as well.

  • Conditional format of one cell based on contents of another cell

    Preparing list of appointments for visitors with time for each. There are four possible status categories for visitors based on projected activity and whether they have shown up or not. (A Group Scheduled, A Group Showed, B Group Scheduled, B Group Showed). I've created the calendar in iCal with different calendars, then accessed that through Bento iCal Events. Bento adds the column with name of calendar from iCal. Info is now in Numbers. (iWorks 09)
    It shows Title, Start Date, Location, Calendar. I'm adding more fields using Lookup in Numbers drawing on entire data base brought over from Bento. I'm trying to get what info I need, but none that I don't, so the form isn't too crowded and busy.
    I would like to be able to conditionally format the Time column based on the contents of the Calendar column. If successful, the color of the Time column would tell me all I need to know about visitor status, and I could hide the Calendar column and clean up the form.
    I hope I've described it adequately. Can this be done, and if so, how?
    Thanks! Have a great Thanksgiving!

    jpcranch wrote:
    Does it work to format two cells based on contents of one of them?
    Conditional formatting of a cell depends on the contents of that individual cell, compared with another value, so no.
    But you could use a two-table approach.
    In general terms, the technique is to:
    • make the original table's cell fill transparent,
    • Add a second table to the sheet,
    • Set the second table to copy the control values into a column of cells,
    • Select the cells in that column of Table 2,
    • Apply conditional formatting rules for each possible control value (see below)
    • Set the text opacity for these cells to 0 (full transparency),
    • Click on Table 2 in the sidebar, then use (shift and) the arrow keys to slide Table 2 behind Table 1 to align the highlighted cells with the cells to appear highlighted in Table 1.
    • Set the colour of the cell borders on table 2 to none.
    Using the information you gave regarding the calendar column, you'll need four rules for conditional formatting of this column. All are of the same format:
    Text contains: A Group Scheduled
    With the text changed to match each possible entry.
    Regards,
    Barry
    BTW: by changing the width of the formatted column on table 2, you can appear to highlight as many columns as you wish on Table 1.

  • Insert value into a column based on value of another column

    Hi,
    I am trying to insert a value into a record based on a column in
    the record, using a trigger. The complication arises because
    the new value is selected from the same table. For example:
    SELECT COL1, COL2, COL3, COL4 from TABLE1
    I want to set COL2 and COL3 based on the value of COL4. And to
    get the value of COL2 and COL3, I will go back to TABLE1 and set
    the condition to TABLE1.COL1 = :NEW.COL4
    I cannot seem to execute the trigger as I get the message "ORA-
    04091: table SYSTEM.TABLE1 is mutating, trigger/function may not
    see it" everytime.
    Is this the correct way to achieve what I wanted? Or is there
    another way?
    Appreciate your feedback. Thank you in advance.

    Hi,
    I am trying to insert a value into a record based on a column in
    the record, using a trigger. The complication arises because
    the new value is selected from the same table. For example:
    SELECT COL1, COL2, COL3, COL4 from TABLE1
    I want to set COL2 and COL3 based on the value of COL4. And to
    get the value of COL2 and COL3, I will go back to TABLE1 and set
    the condition to TABLE1.COL1 = :NEW.COL4
    I cannot seem to execute the trigger as I get the message "ORA-
    04091: table SYSTEM.TABLE1 is mutating, trigger/function may not
    see it" everytime.
    Is this the correct way to achieve what I wanted? Or is there
    another way?
    Appreciate your feedback. Thank you in advance. I'm not sure what you mean when you insert a value into a
    record, but if you are setting a value in a column of the same
    record using a trigger, then it's easy.
    :new.COL2 := ....:new.COL4...
    :new.COL3 := ....:new.COL4...
    The trigger must be 'INSERT or UPDATE' and 'FOR EACH RECORD'.
    If you are setting a different record in the same table, the
    solution is much more difficult.

  • Making a new column out of the values from another column

    I am trying to query the transaction table and the promotion table to get the following output..
          select t.no, t.date,p.groupid,p.promocode,sum(t.salesamt)
          from trans t, promo p
          where t.id=p.tid
          group by t.no,p.groupid,p.promocode,t.date
          order by t.date
    no
    date
    groupid
    promocode
    promodesc
    sum(t.salesamt)
    m12
    01-jun-2012
    09
    p12
    Promotion1
    7890.00
    m12
    01-jun-2012
    09
    p13
    Promotion2
    345.56
    m12
    01-jun-2012
    09
    p14
    Promotion3
    2345.90
    m12
    01-jun-2012
    09
    p12
    Promotion1
    345.12
    m12
    01-jun-2012
    09
    p13
    Promotion2
    23678.00
    m12
    01-jun-2012
    09
    p14
    Promotion3
    3456.78
    I want to remove the promodesc and the sum(t.salesamt) and add Promotion1,Promotion2,Promotion3 as three new columns and their respective sum(t.salesamt) as their data value.
    I am thinking about using three separate case statements to achieve this...
    sum( case when promocode='p12' then t.salesamt end) Promotion 1
    Please let me know if there is any other optimal way to achieve this.
    Thank you!

    Hi,
    What you want is called a Pivot.  Using CASE expressions (like you described) is one common way to do pivots.  If you're using Oracle 11.1 (or higher) then you'd probably want to use the SELECT ... PIVOT feature instead.  See the SQL Language manual
    http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_10002.htm#sthref6809
    and the forum FAQ
    https://forums.oracle.com/message/9362005
    for details and examples.
    If you get stuck, post your best attempt, along with CREATE TABLE and INSERT statements for a little sample data, and the results you want from that data (if different from what you've already posted).
    Always say which version of Oracle you're using (for example, 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • Set the css style of text in a column according to the value of another col

    I'd like to set the css style of text in a column according to the value of another column. Each field may end up with a different style of text as a result, for instance.
    Any ideas? I looked thru the forums but couldn't find anything.
    Thanks,
    Linda

    Does the class=”t7Header” make it into the rendered HTML?
    ---The text "class="tHeader" does not show but the other text is rendered using the style t7Header as defined in the stylesheet! Exactly what I wanted.
    You might want to use a div or a span instead of a p.
    ---Yes -
    What's very cool is we can create a display column that is dynamically filled with the html and style wrappers based on a lookup to see what style should be applied according to the actual data value. This is critical as our tables are all dynamic so I can't depend on using the additional APEX methods to control the display of a column (as the # of columns in the view vary from instance to instance) and I did not want the display specs to muddy up my SQL queries.
    I wonder why this is not well documented. It is so easy!
    Thanks again for your help.
    Linda

  • Summing Selected Rows in Column Depending on Value in Another Column

    I'd like to sum only the values in selected rows in a given column depending on the value of another column in the same row. For example, suppose I have a table (please disregard the underscores, needed for correct alignment):
    ___A____B____C___D
    1__5___10___15___0
    2_20___25___30___1
    3_35___40___45___1
    4_50___55___60___0
    5__sum(D=1)
    In cell B5, I'd like to compute the sum of only rows in column B for which the value of the corresponding column D is 1. In this case B5 would be 65.
    How can I do this using functions? Is it possible to do it for a variable range of rows without specifying each row individually?
    Thanks,
    Dave

    You should place your formula to other collumn then calculated ones or in another table. You will be able to calculate whole collumns with: =SUMIF(D;“=1”;B)
    Formula for your example is: =SUMIF(D1:D4;“=1”;B1:B4)
    VB

  • Making whole row coloured red based on value in one column in BI Answers.

    Hi
    Would anyone know how to make a whole row red (eg) based on the value from one column within the row in
    a BI Answers report in either a pivot table or a table view. I know it should be a case of setting up the
    conditional formatting in the Conditional Tab on the Properties of the column, but all the columns apart from the
    one with the value being determined ignore the value in another column.
    Thanks,
    - Pete
    Edited by: user1636556 on 09-Dec-2011 07:58

    Hi
    Would anyone know how to make a whole row red (eg) based on the value from one column within the row in
    a BI Answers report in either a pivot table or a table view. I know it should be a case of setting up the
    conditional formatting in the Conditional Tab on the Properties of the column, but all the columns apart from the
    one with the value being determined ignore the value in another column.
    Thanks,
    - Pete
    Edited by: user1636556 on 09-Dec-2011 07:58

  • Dynamically display title based on value selected in column selector

    Hi All,
    Can it be possible to show the report title dynamically based on value selected in column selector . suppose i have two column status and region . When i will select status in the column selector the title of the report will show " Status Summary" when i will select region then the title will change to "Region Summary". Please help me...

    Hi,
    create dashboard prompt with column selector functionality like following way
    write the following query in your dashboard prompt sql results
    select region name from subject area name
    Union all
    select sub_region name from subject area name
    like this and put one presentation variable for this dashboard prompt like var1
    in your report write formula in your column like this *case when @{var1)='region column' then 'Region Summary' else ' ' end*
    and refer this column in narrative view like @1 then narrative act like a title view.
    Hope this helps you
    Regards
    Naresh                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Can I assign a task based on information from another column?

    For example:
    Let's say I have a column called "Question Type" and this column has multiple checkbox choice, those being:
         Math
         Science
         History
         English
         Other
    I want to allow users to be able to select multpile catagories for the question, like making one both math and science (which right now is completely possible)
    I then want another column that says who the problem is assigned to. Bob is good at math, Joe at science, Jill at histroy, Jenn at English, and Billy handles everything else.
    1) Is there a way that the task can be automatically assigned to my math expert Bob when I specify that the item I am adding is a math problem?
    2) If I make a problem both math and science, can the task be assigned to both Bob and Joe?
    Thanks in advance!

    Hi,
    According to your post, my understanding is that you wanted to assign a task based on information from another column.
    To assign task to multiple users, you need to:
    Create a workflow and add action: Start Approval Process.
    Click these user, select the Group, change One or a time(serial) to
    All at onec(paralle).
    Right click the action, select Properties, click ExpandGroups, change No to
    Yes.
    Then you can assign task to each member of the group.
    I recommend to follow the steps as below to achieve what you want:
    Create a custom list, add columns: Question Type(Choice); Assigned to(Person or Group).
    Create a workflow associated the list.
    Add conditions and action as below:
    Then the task can be automatically assigned to 123 when the item is a math problem.
    In addition, if you make a problem both math and science, the task can be assigned to both 456 and 789.
    You can add other conditions to satisfy all the requirements.
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • How to create a new row for a VO based on values from another VO?

    Hi, experts.
    in jdev 11.1.2.3,
    How to create a new row for VO1 based on values from another VO2 in the same page?
    and in my use case it's preferable to do this from the UI rather than from business logic layer(EO).
    Also I have read Frank Nimphius' following blog,but in his example the source VO and the destination VO are the same.
    How-to declaratively create new table rows based on existing row content (20-NOV-2008)
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/13-create-with-params-169140.pdf
    I have tried:
    1.VO1(id,amount,remark1) and VO2(id,amount,remark2) are based on different EO,but render in same page,
    2.Drag and drop a Createwithparams button for VO1(id,amount,remark),
    3.add: Create insertinside Createwithparams->Nameddata(amount),
    4.set NDName:amount, NDValue:#{bindings.VO2.children.Amount}, NDtype:oracle.jbo.domain.Number.
    On running,when press button Createwithparams, cannot create a new row for VO1, and get error msg:
    <Utils> <buildFacesMessage> ADF: Adding the following JSF error message: For input string: "Amount"
    java.lang.NumberFormatException: For input string: "Amount"
         at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
    Can anyone give some suggestions?
    Thanks in advance.
    bao
    Edited by: user6715237 on 2013-4-19 下午9:29

    Hi,CM,
    I'm really very appreciated for your quick reply! You know, today is Saturday, it's not a day for everyone at work.
    My principal requirement is as follows:
    1.select/check some rows from VO2, and for each selection create a new row with some attributes from VO2 as default values for VO1's corresponding attributes, and during this process the user may be cancel/uncheck or redo some of the selections.
    --so it's better to implement it in UI rather than in EO.
    2.it's better to implement this function with declarative way as in Frank Nimphius' blog.
    --little Jave/JS coding, the better. I only have experience in ORACLE FORMS, little experience in JAVA/JS.
    In order to get full information for the requirements of my use case, can take a check at:
    How to set default value for a VO query bind variable in a jspx page?
    (the end half of the thread: I have a more realworld requirement similar to the above requirement is:
    Manage bank transactions for clients. and give invoices to clients according to their transaction records. One invoice can contain one or many transactions records. and one transaction records can be split into many invoices.
    Regards
    bao
    Edited by: user6715237 on 2013-4-19 下午11:18
    JAVE->JAVA

  • Is it possible to reference one cell from the value of another?

    Is it possible to reference one cell from the value of another e.g.
    value of b1 = value of c(value of a1)
    So if a1 = 3 then b1 = c3, if a1 = 5 then b1 = c5.

    Excellent!
    Thanks Wayne. Just saved me many hours and a headache.
    Works like a dream.
    Thank you for your succinct (and accurate) answer.
    Mark

  • How to copy one column BLOB value into another column of another database.

    How to copy one column BLOB value into another column of another database.
    BLOB value contains word document.
    I thought of copy the BLOB value into a text file and then update the new column value by the same text in textfile. Will this work?
    Is there any other better way to do this?

    You're welcome
    BLOB fields contains binary data. I don't think you can do this
    Also if I view the BLOB as text. Can I copy it and insert into the new database.
    I think your options are as I said. Datapump or CTAS
    Best Regards

  • Need to get sequence value in another column in oracle

    Hi ALL,
    I have sql query as below
    select header_id,order_number from oe_order_headers_all.
    and data it is displaying as
    heder_id     order_number
    111            500001
    121            500400
    I need to display  another field with some sequence value like as below
    id     heder_id     order_number
    1      111                    500001
    2      121                    500400
    so how to get sequence value in another column please help me on this.
    Thnaks

    You can just use ROWNUM Pseudocolumn
    select rownum id, header_id,order_number from oe_order_headers_all

Maybe you are looking for

  • How to find the root document in my application, if application is deployed as  EAR file ??

              Hi,           I want the real path, i mean root document.           I my EAR file, i have only one WAR file. In my WAR file the following are the           folders:-           enterprise/..           properties/sql/..           locale/..   

  • Update the schema for data foundation, business element and business view

    Hi All I am using oracle 11g as backend to develop using crystal reports and I am using Business View Manager as the connection in crystal reports. Now my issue here is I have created the DC, DF, BE and BV using abc schema but as the request has chan

  • Face detect behavior on previously tagged images

    Hi, I transfered all my previously tagged images (before face detect feature was available) to the newly created "people" tags. For example, PSE8 face detect created a tag for Claudia (my wife), I then transfered all the photos with my wife on them t

  • IStore Customization------regarding Search page

    Hi all, I am new to iStore Customization, during customization of iStore, i am stuck at Search page ,ie..ibeCSrdSrchResults.jsp.........in that i want to get image for particular item.But in the API, they gave one mehtod how to get the image,ie... us

  • Trace not working

    Hi , I am using Adobe flash cs5. I used to create Air application on the publish settings. While i run the air application in side the Adobe flash cs5 it update the "Application Data\Macromedia\Flash Player\Logs\flashlog.txt" but once i compile them