Return a value based on multiple criteria

Dear Support Community,
I am trying to formulate a function so that I am able to return a cell value based on more than one criteria.
Referring to the attached screen shot, "Local Start Time" refers to the time that a person will start a work shift, and depending on the "sectors" the person's duration of time at work will vary.
For example, if a person starts work between 07:00am and 07:59am AND the particular shift involves 2 sectors, the allowed time at work is 12H15M. However, given the exact start time, if the shift only involves ONE "sector' the allowed time at work becomes 13H00M etc.
I am trying to formulate a function whereby I can tell the spreadsheet the local start time AND sectors, and then have the appropriate time returned.
I hope the above makes sense!
Thanks
ST

Hi ST,
Print your table and pin it up as a "Ready Reckoner" for humans to refer to.
Convert your table into a Database, something like this:
Start
Finish
Sectors
Allowed Duration
Scenario
0700
0759
1
13h 0m
1
0700
0759
2
12h 15m
2
0700
0759
3
11h 30m
3
0800
1259
1
14h 0m
4
0800
1259
2
13h 15m
5
0800
1259
3
12h 30m
6
1300
1759
1
13h 0m
7
1300
1759
2
12h 15m
8
1300
1759
3
11h 30m
9
1800
2159
1
12h 0m
10
1800
2159
2
11h 15m
11
1800
2159
3
10h 30m
12
2200
0659
1
11h 0m
13
2200
0659
2
10h 15m
14
2200
0659
3
9h 30m
15
(You may want to check that I have converted correctly)
Columns A and B have a Custom Format that allows them to be numbers (not Text) with leading zeroes.
Hide Separator to get rid of the comma
Show zeroes for Unused Digits to show leading zeroes.
Then you can enter "Army Time" (24 hour clock with leading zeroes) into a Query table
Thunderstorms playing havoc here with my internet connection. I will post this now. Watch for the next instalment.
Regards,
Ian

Similar Messages

  • Return array value based on selection criteria

    I have one data field that holds text data similar to below:
    "Meeting Room 1 (Projector), Meeting Room 2 (Whiteboard), Meeting Room 3 (Video Conferencing)"
    "Meeting Room 3 (LCD Display), Meeting Room 1 (Video Conferencing), Meeting Room 2 (Whiteboard)"
    The meeting rooms are not always in the same order, I cant count on Meeting Room 1 being followed by Meeting Room 2 etc.
    My objective is to only return the meeting room that has the Whiteboard.
    I'm aware that I can use SPLIT to seperate the Meeting Rooms by the comma and place their components into an array.
    What I'm not sure how to do is return the meeting room with the Whiteboard when that could be [1] in the Array or [2] or [3] in the array.
    I need to return the array value based on its contents. Could someone help me 'search' the array created by the SPLIT command and always return that value with the word 'Whiteboard'

    This works
    whileprintingrecords;
    global stringvar x:='';
    global numbervar n:=1;
    While n <= Ubound(split('......, Meeting Room X (Whiteboard),..............', ",")) Do
    if split('..........., Meeting Room X (Whiteboard), ............', ",")[n] like '*Whiteboard*'
    then x:=split('.............., Meeting Room X (Whiteboard), ..............', ",")[n];
    n := n + 1;
    x;
    Just replace my string with your field.
    Ian

  • Totals Based on Multiple Criteria in Repeating Rows

    Hi All,
    I have 3 dropdowns (DD1, DD2, DD3) and one textfield (TF1) in repeating rows (not in a table).  Each dropdown has two choices and the textfield is free-form. Outside of the rows (in a different subform) I want totals based on multiple criteria from the dropdowns and textfields.
    The following script works great to get a total number of one choice from one dropdown.
    this.rawValue = xfa.resolveNodes('form1.Form.row[*].DD1.[$.rawValue == "2"]').length;
    Problem is how do I calculate the totals for the following based on the criteria listed in each row.
    Find the totals for ML
    Number of New Forms 1-2 Pages: (result should be 2)
    Number of New Forms 3+ Pages: (result should be 1)
    Number of Revised Form: (result should be 0)
    In row #1:  select “New” as a choice from DD1, “Form” as choice from DD2, “ML” as a choice from DD3 and enter “5” in TF1.
    In row #2:  select “New” as a choice from DD1, “Form” as choice from DD2 , “ML” as a choice from DD3 and enter “1” in TF1.
    In row #3:  select “New” as a choice from DD1, “Form” as choice from DD2, “ML” as a choice from DD3 and enter “2” in TF1.
    In row #4:  select “Revised” as a choice from DD1, “Series” as choice from DD2, “ML” as a choice from DD3 and enter “1” in TF1.
    In row #5:  select “New” as a choice from DD1, “Form” as choice from DD2, “PM” as a choice from DD3 and enter “1” in TF1.

    Try something like;
    var mlNewForms1or2Pages = 0;
    var mlNewFormsOver3Pages = 0;
    var mlRevisedForms = 0;
    var rows = xfa.resolveNodes('form1.Form.row[*]');
    for (var i = 0, limit = rows.length; i < limit; i++)
    var currentRow = rows.item(i);
    if (currentRow.DD1.rawValue == "1") // new
      if (currentRow.DD2.rawValue == "1") // form
       if (currentRow.DD3.rawValue == "1") // ML
        if (parseInt(currentRow.TF1.rawValue, 10) > 2)
         mlNewFormsOver3Pages++;
        else
         mlNewForms1or2Pages++;
    else // revised
      if (currentRow.DD2.rawValue == "1") // form
       if (currentRow.DD3.rawValue == "1") // ML
        mlRevisedForms++
    console.println(mlNewForms1or2Pages);
    console.println(mlNewFormsOver3Pages);
    console.println(mlRevisedForms);
    To do the same using predicates you could do;
    var mlNewForms1or2Pages = 0;
    var mlNewFormsOver3Pages = 0;
    var mlRevisedForms = 0;
    mlNewForms1or2Pages = xfa.resolveNodes('form1.Form.row.[DD1 == 1 and DD2 == 1 and DD3 == 1 and TF1 <= 2]').length;
    mlNewFormsOver3Pages = xfa.resolveNodes('form1.Form.row.[DD1 == 1 and DD2 == 1 and DD3 == 1 and TF1 > 2]').length;
    mlRevisedForms = xfa.resolveNodes('form1.Form.row.[DD1 == 2 and DD2 == 1 and DD3 == 1]').length;
    But if you wanted totals for all the permutations then this could become slow.
    Regards
    Bruce

  • Person DFF Context Value based on 2 criteria (Business Group and Emp Type)?

    Hello,
    We're implementing HR module into multiple business groups.
    I need to define context value for DFF "Additional Personal Details" based on 2 criteria Business Group ID and Employee Type
    Any idea how to do it?
    Thank you
    Elie

    Hello Elie,
    I am not sure on it,However have you tried creating a context with combination of Business Group and Person Type using merging,
    business_group_id || "_"|| person_type_id And structures would be something like 80_2112 Business Group id = 80 and Person Type id=2112.
    It may resolve your issue if this works out.
    Regards,
    Saurabh

  • Returning Different Results Based on Input Criteria

    I have a complex nested select statement. Based on selection criteria I want to return different results. Say for instance I had an input parameter Called Products which could contain a Yes/No Flag. If the Flag was Yes then I would want the "top" select, statement to be The following:
    Select Product, Time_ID, Amt
    From
    My Complex Nested Select
    But if Product was set to "No", I would want the following:
    Select Time_ID, Amt
    From
    My Complex Nested Select
    I know, or course that I can have two COMPLETE set of SQL which are invoked based upon testing the value of the PRODUCT Parameter, but If I duplicate the "inner nested select" then I have 2 sets of select staments to maintain. Is there an alternative to this? Could I make the inner portion which does not change a function of some sort so that my code would look something like this?
    Select Product, Time_ID, Amt
    From
    Execute myNestedSelectFunction
    But if Product was set to "No", I would want the following:
    Select Time_ID, Amt
    From
    Execute myNestedSelectFunction
    This would atleast ensure that I only have to go one place to maintain the logic of the "static Nested Select" statement.
    Just want to make sure I do not have a real viable alternative to "duplicating code"
    Thanks

    Hi,
    Look in TFM for PIPELINED functions which will allow you to:SELECT Product, Time_ID, Amt FROM TABLE(myPipelinedFunctionReturningSelectResult()) T;
    SELECT Time_ID, Amt FROM TABLE(myPipelinedFunctionReturningSelectResult()) T;There are samples if you look on AskTom too.
    Regards,
    Yoann.

  • Help me write command in vba(excel) to search and find special cells based on multiple criteria

    Hi 
    My name is Majid Javnmard , I am using Microsoft Office Excel 2010 and I encountered a problem. I sent you a simple example of my excel file that i want to write a command in vba to search and find special cell and copy the row which special cell is in there
    somewhere , but the problem is how can i find my special cell with multiple criteria or how can i find my all special cells and copy them somewhere !!? 
    Let me explain on file that i sent :
    This file has 4 headers (X,Y,PerturbNumber,Value), the problem is for example : I want write commnd in vba to copy all rows that each of them has (X=12 and Y=13). how can i ? can you help me ?
    My
    file : http://s000.tinyupload.com/index.php?file_id=69742844961096241754
    Many Thanks
    Majid 

    This worked for me, based on your example:
    Sub pMain()
    Dim wsSource As Excel.Worksheet
    Dim wsDest As Excel.Worksheet
    Dim lSource As Long
    Dim lDest As Long
    Dim lLast As Long
    With ThisWorkbook
    'Change to suit
    Set wsSource = .Worksheets("Sheet1")
    Set wsDest = .Worksheets.Add
    End With
    wsSource.Rows(1).Copy
    wsDest.Range("A1").PasteSpecial xlPasteValues
    lDest = 2
    lLast = wsSource.Cells(wsSource.Rows.Count, "A").End(xlUp).Row
    For lSource = 1 To lLast
    'Put the conditions below:
    If wsSource.Cells(lSource, "A") <> 12 Then GoTo linNext
    If wsSource.Cells(lSource, "B") <> 30 Then GoTo linNext
    'If wsSource.Cells(lSource, "C") <> "value" Then GoTo linNext
    'If wsSource.Cells(lSource, "D") <> "value" Then GoTo linNext
    'Conditions were met:
    wsSource.Rows(lSource).Copy
    wsDest.Rows(lDest).PasteSpecial xlPasteValues
    lDest = lDest + 1
    linNext:
    Next lSource
    End Sub
    Felipe Costa Gualberto - http://www.ambienteoffice.com.br

  • Get the master table value based on multiple fact tables

    I have an master table which has to filter data based on multiple fact tables
    In the below sample, i need to get the list of MasterTable SId in an single query for fetching data from all the fact tables with an criteria.
    Can u let me know the single query to handle the below situation
    Select count(1) from dbo.DimMaster where sid in
    (Select Master_sid from dbo.factsales where SalesDate < '20141231')
    Select count(1) from dbo.DimMaster where sid in
    (Select Master_sid from dbo.factPurchase where PurchaseDate < '20141231')
    Select count(1) from dbo.DimMaster where sid in
    (Select Master_sid from dbo.factSalary where SalaryDate < '20141231')
    Select count(1) from dbo.DimMaster where sid in
    (Select Master_sid from dbo.factMarket where MarketDate < '20141231')
    ShanmugaRaj

    Please try below:
    SELECT
    (SELECT count(1)
    FROM dbo.DimMaster
    WHERE sid IN (
    SELECT Master_sid
    FROM dbo.factsales
    WHERE SalesDate < '20141231'
    )) as C1,
    (SELECT count(1)
    FROM dbo.DimMaster
    WHERE sid IN (
    SELECT Master_sid
    FROM dbo.factPurchase
    WHERE PurchaseDate < '20141231'
    )) as C2,
    (SELECT count(1)
    FROM dbo.DimMaster
    WHERE sid IN (
    SELECT Master_sid
    FROM dbo.factSalary
    WHERE SalaryDate < '20141231'
    )) as C3 ,
    (SELECT count(1)
    FROM dbo.DimMaster
    WHERE sid IN (
    SELECT Master_sid
    FROM dbo.factMarket
    WHERE MarketDate < '20141231'
    )) as C4
    -Vaibhav Chaudhari

  • Returning  'Day' value based on month and year parameters

    Hi,
    Is there a code that would return an end of the month  Day value based on month and year parameters?
    For example if my parameters yield 9 or September for a month value and 08 or 2008 for the year value, can a formula generate a value of 30 (the last day of the given month in the specific year)?
    This way the formula would pick up the different last day of the month in February for the leap years.
    Thank you.
    Vic

    1. Open the formula workshop.
    2. From the Repository Custom Functions, under Crystal and then Date, RIGHT click on cdlastdayofmonth, click on ADD TO REPORT.
    3. Create a new formula, in the formula workshop, under FUNCTIONS, go down the list till you see "CUSTOM FUNCTIONS", expand that till you see cdlastdayofmonth.
    4. In your formula, type cdlastdayofmonth(currentdate)
    5. Save and close and display the formula in your report, you should see 11/30/2008.
    If you want just the day then modify the formula to:
    totext(day(cdlastdayofmonth(currentdate)),0,'','');
    since you have parameters for month and year, do this:
    totext(day(cdlastdayofmonth(date({?year},{?month},01))),0,'','');
    to give you the last day of the month.

  • Return 2 values (string, number) multiple rows, from java stored function

    I would like to return 2 values (String, number prefered but String, String will work) from a java stored function.
    I was able to successfully return a varray of varchar2 values but I was wondering if it is possible to return 2 values by using a varray?
    Is it even possible? I tried using combinations of types which included a varray of objects (with 2 attributes) or a type as table of objects but I couldn't figure out how in my java code to set these values. Also what would my java function return type be and what Oracle type would map to it?
    Any help and examples or pointers would be great.
    Thanks,
    Dennis

    Thanks to all. I finally figured it out through all the pieces on the web.
    Here is what worked for me. First create 2 oracle types. One object type to represent the "columns" I will pass back:
    CREATE OR REPLACE TYPE COST_OBJ AS OBJECT (COST_NAME NVARCHAR2(50), COST_VALUE number ) NOT FINAL
    note: make sure the "strings" are defined as NVARCHAR2 or Java will puke if it is just VARCHAR2.
    Then create a table type to hold your objects defined as following:
    CREATE OR REPLACE TYPE COST_OBJ_TABLE is table OF COST_OBJ
    Then create the oracle stored function that is a wrapper to the java function:
    CREATE OR REPLACE FUNCTION get_Costs(Name VARCHAR2, evalDate VARCHAR2, fuelCodeID NUMBER) return COST_OBJ_TABLE
    is language java name
    'com.costs.storedProcedures.Cost.getCosts(java.lang.String, java.lang.String, int) return oracle.sql.ARRAY'
    Once that is done, Oracle is ready. The Java function looks something like this:
    public ARRAY getCosts(String name, String evalDate, int fuelCodeID) {
    DBAccess da = getDBAccess();
    // get a handle on the connection
    Connection conn = da.getConnection();           
    // The stuff that will be returned should be as type object array
    // make it to the size of the number of fuelcomponents passed in
    Object[] returnStuff = new Object[3];
    // create the type of struct that is defined on the database
    StructDescriptor structDesc =
    StructDescriptor.createDescriptor("CY_UMAP.COST_OBJ", conn);
    for (int i = 0; i < returnStuff .size(); i++) {
    Object[] costValues = new Object[]{
         "This is object " + i,
         new Integer ( i ) };
    STRUCT cost_obj = new STRUCT(structDesc, conn, costValues);
    returnStuff[i] = cost_obj;
    ArrayDescriptor x_ad = ArrayDescriptor.createDescriptor (
    "CY_UMAP.COST_OBJ_TABLE", conn);
    ARRAY x_array = new ARRAY(x_ad, conn, returnStuff);
    return x_array;
    I hope this helps others.
    Dennis

  • Returning a value based on user-supplied sql variables

    I'm using JDeveloper 10.1.3.1, ADF and JSP.
    I want to return a primary key based on values a user enters in unbound fields (like inputText). They'll be entering information for a record including a 10-segment GL code, and when the other bound values are committed, I'd like the associated GL id to be returned for the row (if found). Validation is not necessary at this point. A null return is okay.
    I've defined bind variables in a GL view object - one for each of the 10 segments - plus a jspx form with 10 inputText objects.
    Does it sound like this is going in a logical direction? I'm stuck at this point, and am open to suggestions.

    1. Open the formula workshop.
    2. From the Repository Custom Functions, under Crystal and then Date, RIGHT click on cdlastdayofmonth, click on ADD TO REPORT.
    3. Create a new formula, in the formula workshop, under FUNCTIONS, go down the list till you see "CUSTOM FUNCTIONS", expand that till you see cdlastdayofmonth.
    4. In your formula, type cdlastdayofmonth(currentdate)
    5. Save and close and display the formula in your report, you should see 11/30/2008.
    If you want just the day then modify the formula to:
    totext(day(cdlastdayofmonth(currentdate)),0,'','');
    since you have parameters for month and year, do this:
    totext(day(cdlastdayofmonth(date({?year},{?month},01))),0,'','');
    to give you the last day of the month.

  • How to count unique values based on specific criteria

    Hello,
    I need to count the number of unique values in column A but only if the text in column I is a specific word - how do I do this? 

    Let's say the values are in A1:A10 and they are numeric, and the text is in I1:I10.
    As an array formula, confirmed with Ctrl+Shift+Enter:
    =SUM(IF(I1:I10="word",1/COUNTIFS(A1:A10,A1:A10,I1:I10,"word")))
    where "word" is the specific word you're looking for.
    Regards, Hans Vogelaar (http://www.eileenslounge.com)

  • Return a value based on dropdown list

    I am a newbie in making PDF form and had recently started working with Live cyle to create a fillable form and managed to create a usable one patterned with the sample Purchase Order Form (by trial and error) which came along with the installation. Can somebody please help me with this form.  I have a dropdown list on the ITEMS column and want it to automatically display the unit price of the item selected from the drop down list. By the way I managed to make the table flowable.

    http://forms.stefcameron.com/2009/02/25/expandable-table-with-totals/

  • Value based Creditmemo

    Hi,
    Good afternoon.
    In SBO how we can raise a Credit memo/Return (only Value based) to a Customer  with out referring item,A/R Invoice or Delivery.
    Vinay

    Hi Vinay,
    Two ways of doing this:
    1.  on the credit memo screen you can change the Item/Service Type field to be Service and raise it as a service credit note.
    2.  If you have a stock item that is just Sales or Purchase (NOT Stock) then you can add this into a Credit Memo and change the description of the item and then press Cntrl and TAB to move out of the field.  You must press Cntrl and TAB other wise SAP will try to search on the description you enter.
    The credit memo will be value based and will not refer to the item or invoice.
    Regards,
    Adrian

  • Update col value based on another tbl - update, case stmt, subquery

    I need to
    1) add a column col1 to existing table tbl1;
    2) the value of col1 will be updated from the column col2 value from table tbl2;
    3) if the tbl2 returns many records or no records, the col1 value will be defaulted to 0; otherwise it will be the unique value from the col2 of tbl2
    I am stuck.
    Thanks.

    hI,
    new2Oracle wrote:
    I need to
    1) add a column col1 to existing table tbl1;Use ALTER TABLE.
    2) the value of col1 will be updated from the column col2 value from table tbl2;
    3) if the tbl2 returns many records or no records, the col1 value will be defaulted to 0; otherwise it will be the unique value from the col2 of tbl2Use a CASE expression to test if there is exactly one matching row or not, and return a value based on that.
    For example:
    UPDATE  tbl1     t1
    SET     col1     = (
                SELECT  CASE
                        WHEN  COUNT (*) = 1
                        THEN  MIN (col2)
                        ELSE  0
                      END
                FROM       tbl2
                WHERE       common_column_1     = t1.common_column_1
                AND       common_column_2     = t1.common_column_2
    ;Since the sub-query is using an aggregate function (COUNT), the value returned must also be an aggregate (like MIN) or a constant (like 0). In cases where there is only 1 row, we could use MAX, AVG or SUM instead of MIN to get the value of that one row.

  • Select MULTIPLE default values for a multiple selection list box based on another field in Infopath 2010

    Hello there - Before I explain my issue, I would like to point out that I have reviewed some other discussions on selecting default values for multiple selection listbox. But my issue is specific and different, and not answered by any of the discussions
    I visited.
    I have a multiple selection list box (say for example all countries in the world as values), and I would like to pre-select or setup multiple default values (say five countries) based on some criteria that I query from MS SQL database table.
    I know we can go to Data | Default Values option to setup one or many default values for multiple selection list box. When I enter the default values manually this works. I also right click the field under the Multiple-Selection List Box group, then select
    Add another Value Below and set the Default Value for this field to setup multiple default values.
    However, if I reference a field (either an infopath field or a field from SQL database) I am not able to setup multiple default values. Infopath automatically selects the last field I selected for all instances and in the end I am able to see only one
    default value selected instead of many. How to fix this problem? Why would infopath allow multiple default values when we enter it manually but not when we reference some fields?
    Please let me know if you need more info. Appreciate your help.
    Thanks!

    Hi redhotc,
    According to your description, my understanding is that you want to set multiple default values for a multiple checkbox list in InfoPath form.
    I did a test with SQL database table. I set three default values for the checkbox list by adding three values field under the group field(Data->Default values), each value field is for a default value. Then publish it to my SharePoint site, everything
    was fine.Please have a try as the below link:
    http://www.bizsupportonline.net/infopath2010/pre-select-items-multiple-selection-list-box-infopath-2010.htm
    Note: if you are using SQL databse table, you may need to enable ‘Allow cross-domain data access for user form templates that use connection settings in a data connection file’ in CA. More information, please refer to:
    http://answers.flyppdevportal.com/categories/sharepoint2010/sharepoint2010customization.aspx?ID=418b9423-a96c-4e5e-91f9-6a1b010ebb69
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

Maybe you are looking for

  • Credit Memo Deletion

    Dear All, A Credit Memo Request was generated and then a Credit Memo was created and posted to FI. The credit memo was cancelled for some reason. Now the user want to delete the Credit Memo Request as it is showing in billing due list. User does not

  • How do I rename a volume on an external hard drive

    I have a 500 GB Iomega USB external hard drive divided into 3 volumes. The largest one used to be my Time Machine backup, but I needed more room and have added a new drive for the purpose and want to change the name of the old backup volume to someth

  • How to access BIS login page

    I have a Straight Talk Blackberry. I have created my blackberry email address and activated my phone. I found the Straight Talk BIS login portal here: https://bis.na.blackberry.com/html?brand=tw But I don't have a login for it. I called Straight Talk

  • IPhoto Book Purchasing procedure stuck

    I cannot complete the procedure to purchase the book from iPhoto, as a telephone number is a mandatory field and it keep showing error - does not accept the entry. The issue is that most phone numbers in Italy (both home and mobile) have 6 or 7 digit

  • S_ALR_87013166 Variance Issue

    While comparing the results between report (S_ALR_87013166) VS KOB3 report for one of order, we found that two materials  has difference between target and actual cost in s_alr_87013166 but without appearing in the variane column and also when checki