Function: Return First Line of Another Cell (before line break)

Howdy all!
I have a bunch of cells that have multiple lines (line breaks created by pressing option-return). I want to create a function that will return the first line of a cell (IE: the text before the first line break). Any thoughts on how to do this?
IE, if A1=
Test 1
Test 2
Test 3
Then I want to point the function from another cell to A1 and have it return Test 1.
The code would look like this:
=REPLACE(A1,SEARCH([line break],A1),LEN(A1)−SEARCH([line break],A1)+1,"")
(IE: It searches for the line break, then replaces everything from that part on with nothing.)
The problem is that I don't know how to get Numbers to think about [line break]. Thought that =char() would work but I don't know the unicode to put in (85, 2028, and 2029 didn't work).
Thoughts?
Matthew

Thanks, I thought that I had tried that at some point, but I guess I hadn't done it correctly!
I made one adjustment, I subtracted one from the SEARCH. The formula as you have it actually returns the line break along with the first line (you can't see it in your example because your rows are taller). (I also removed the third peramiter from the SEARCH, but that is a personal preference.) Outside of that this works perfectly. Thanks!
B1=LEFT(A1,SEARCH("
",A1)−1)
Matthew

Similar Messages

  • Mystery! line 2 is executing before line 1

    This is such a mystery that line 2 is execute before line 1.
    please read slowly.
    Example! I have a class Payment to make a payment. I could
    Call it from 2 classes from class CustomerFrame and from
    class AllBalance. and all classes has the customers balance.
    now class Payment receives in the constructer. or an object from
    class CustomerFrame. or an object from AllBalance.
    in order to change the balance from that object.
    now after i'm inserting A payment I
    have to change the balance from the other classes. so I do A
    commit to the database from class Payment. and then I dispose the other
    classes and I create A new object from the other classes what I dispose so the is changed.
    now please look at this code. Problem with last line of code
    //class references
    CustomerFrame customerFrame;
    AllBalance allBalance;
    Object object;
    // constructer
    public Payments( Object o )
    super("Payment");
    object = o;
    if ( object instanceof AllBalance )
    allBalance = (AllBalance) object;
    else if ( object instanceof CustomerFrame )
    customerFrame = (CustomerFrame) object;
    //now after I�m inserting A payment I right
    if ( object instanceof CustomerFrame )
    customerFrame.dispose();
    customerFrame = new CustomerFrame();
    //customerFrame.setCustomer(database.findPerson(id));
    else if ( object instanceof AllBalance )
    allBalance.dispose();
    allBalance = new AllBalance( );
    Payments.this.toFront();
    Now with this last line I have problems. What?
    If the �else� statement is execute its ok the Payment frame is on top
    but if the �if � statement is execute. Problem! the Payment frame is in back,
    but its funny if I put in A JOptionPane.showMessageDialog after the last line from the
    �if� statement it works ok;
    my god what is he asking?
    If you don�t understand my question please give me A code.
    That if I change something
    from one frame it should change something from the other frame

    I can't really understand the question completely, but it sounds to me like the Frame is not coming to the front like it should. The easiest way I have found to make things act sane when a it seems like your swing method isn't doing anything is to actually invoke it through SwingUtilities.invokeLater() ... e.g. for the code you have shown
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
       public void run() {
          Payments.this.toFront();
    });I don't garuantee that will work but it has seem to help me MANY times when I was extremely perplexed at what was going on. This forces your code to run on the even-dispatch thread (?I think anyways?).
    Hope this helps,
    Will

  • Is there a way of getting LOOKUP function to return the address of a cell rather than the value?

    Hi
    I am wondering if there is a way of converting the value found in a LOOKUP function into a reference for the cell in question.
    I have constructed the following formula:
    =OFFSET(LOOKUP(A2,August :: $A),2,2)
    In an attempt to return the value of a cell which is two rows and two columns away from the cell returned by a LOOKUP function.
    But I am getting the error Argument 1 of OFFSET expects a reference but found "Name."
    Could someone advise?
    Thanks,
    Nick

    nick_harambee wrote:
    Hi
    I am wondering if there is a way of converting the value found in a LOOKUP function into a reference for the cell in question.
    I have constructed the following formula:
    =OFFSET(LOOKUP(A2,August :: $A),2,2)
    In an attempt to return the value of a cell which is two rows and two columns away from the cell returned by a LOOKUP function.
    But I am getting the error Argument 1 of OFFSET expects a reference but found "Name."
    Could someone advise?
    Thanks,
    Nick
    Nick,
    To find the row that a searched-for value is in, use MATCH.
    Jerry

  • I format a cell with a double line at the bottom and it appears until I move to another cell and the formatting is lost.

    In Numbers, I format a cell with a double line at the bottom and it appears until I clik on another cell and then it disappears.

    When you describe the "double" line are you talking about something like this?
    If so this is only selecting an edge of a cell.  You still have to select:
    1) Line style using the menu to the right of the one I have circled (currently  "Thin")
    2) Line width using the menu to the right of the previous one and, finally,
    3) the line color using the menu to the right of the previous one
    Even so I have not found a way to copy cell border formatting so I ALWAYS wait until the very end to add border formatting.

  • Oracle 11g Table function returns no records on first call

    Hello,
    On a Oracle 11g R2 I've a table function ( PIPELINED ) returning rows selected from a table.
    The first time the function is selected, in a session ( I've tried to disconnect and log in again ), it returns no rows.
    I've tried to log the call using DBMS_OUTPUT and from what I see the select on the table function returns no rows and no output is printed. So I presume Oracle is not calling the function.
    The same function on a similar environment ( same db versions, patches and database structure ) works fine. The second environment is a production environment so it has more memory and some other settings enabled.
    Does anyone know of settings that can relate to this behaviour ?
    Thanks in advance for the help.
    Regards,
    Stefano Muret

    Thank you for answering so fast.
    Here's the function code:
    FUNCTION template_parameters (iTemplate IN TEMPLATE_RAW_DATA.TMPL_ID%TYPE := NULL)
    RETURN table_type_tmpl_parameters PIPELINED
    IS
    li_exception INTEGER DEFAULT -20025;
    POUT_PARM TABLE_TYPE_TMPL_PARAMETERS;
    lt_parms table_type_tmpl_parms_raw;
    sParmCheck VARCHAR2(4000);
    iOccurrence INTEGER;
    BEGIN
    pOut_Parm := table_type_tmpl_parameters();
    pOut_Parm.EXTEND;
    select
    tmpl_id
    *,tmpl_name*
    *,replace(upper(trim(sql_out)),'[SCHEMA].')*
    *,UPPER(TRIM(out_tmpl_parms))*
    bulk collect into lt_parms
    from ref_templates
    where tmpl_id = NVL(iTemplate,tmpl_id)
    order by tmpl_id;
    FOR k IN 1..lt_parms.COUNT
    LOOP
    pOut_Parm(1).tmpl_id := lt_parms(k).tmpl_id;
    pOut_Parm(1).tmpl_name := lt_parms(k).tmpl_name;
    FOR i IN 1..2
    LOOP
    IF i = 1 THEN
    sParmCheck := lt_parms(k).sql_out;
    ELSE
    sParmCheck := lt_parms(k).sql_parms;
    END IF;
    iOccurrence := 1;
    *pOut_Parm(1).parameter_name := regexp_substr(sParmCheck,'\[[^\[]+\]',1,iOccurrence);*
    WHILE pOut_Parm(1).parameter_name IS NOT NULL
    LOOP
    PIPE ROW (pOut_Parm(1));
    iOccurrence := iOccurrence + 1;
    *pOut_Parm(1).parameter_name := regexp_substr(sParmCheck,'\[[^\[]+\]',1,iOccurrence);*
    END LOOP;
    END LOOP;
    END LOOP;
    RETURN;
    EXCEPTION
    WHEN OTHERS THEN
    RAISE_APPLICATION_ERROR(li_exception,SUBSTR(SQLERRM,1,1000));
    RETURN;
    END template_parameters;
    This function is part of a package.
    The data on both environments is the same.

  • How do i skip a line if a function returns 0

    Currently i am producing a report that was passed a starting point parameter. Meaning i want an hourly wage above this number. Now in the report i run the following function. Now if the number the function return is less than 5 then i do not what that line/record to display in the report. Can anyone tell me where to look to understand how to accomplish this.
    howard
    function WAGE_TYPEFormula return Number is
    my_num number(10)
    begin
    IF :salary_type = 'BIWEEKLY' then
                   return :salary / 80;
    end if;     
    IF :salary_type = 'MONTHLY' then
                   return :salary / 173.34;
    end if;     
    IF :salary_type = 'ANNUAL' then
                   return :salary / 2080;
    end if;     
    IF :salary_type = 'HOURLY' then
         return :salary;
    end if;     
    IF :salary_type IS NULL then
                   return 0;
    end if;     

    U need to use a lexical parameter
    Go to data model and add a user paranmeter of name say
    test_param . Make sure the characer size is adequate
    and in your function have this parameter
    :test_param := 'whateever u want or dont want to display'
    and in the design model include a field with source "test_param"
    during runtime the report will display whtever is in test_param

  • How do i add multiple lines in a cell (like a list) in Excel for MAC?

    I'm trying to add multiple lines (in the form of a list) in a individual cell in Excel for MAC.  I used ALT Enter on my PC but that doesn't work on the iMac.  Does anyone know how to do this?
    Thanks!

    It's been a while but I think you hold SHIFT while typing a page break (RETURN) to make a new line without shifting to another cell.
    However, as Excel isn't an Apple product, I am sure you will get a faster and more current answer by using Microsoft's Office:Mac forums here:
    Office for Mac forums
    They are very good.

  • In the previous version, the menu table in table options, there is an option that gives me the option: the Return key moves to next cell. I do not see this option in the new number. can you help me please?

    in the previous version  of Number, the menu table in table options, there is an option that gives me the option: the Return key moves to next cell. I do not see this option in the new number. can you help me please?

    Hi silvano,
    If you use a regular pattern when entering values, press enter (return) after entering the last value in a row. That will take you to the first Body Cell of the next row.
    Start in Cell B2
    1 Tab 2 Tab 3 Enter
    4 Tab 5 Tab 6 Enter
    7 Tab 8 Tab 9 Enter
    Now you are ready to type into B5 .
    Another way that some people find easier is to enter one column at a time
    Start at B2
    1 enter
    4 enter
    7 enter
    etc.
    Now start with C2.
    Use whatever suits your work flow.
    Regards,
    Ian.

  • Function returns nothing !!

    I ve a SELECT statement that is working perfectly when i execute it alone and if i use the same SQL in a function and try to return the value, its giving me nothing !!. The is code is as below.
    create or replace function f_get_comp_os(p_fdt date)
    return number
    is
    p_ret number(10,2);
    cursor c1 is
    SELECT NVL(SUM((DECODE(PARA_VALUE,PARA_VALUE,DECODE(A.OST_TYPE,'P',A.OST_LC_ORG_AMT,A.OST_LC_AMT),
    DECODE(A.OST_TYPE,'P',A.OST_FC_ORG_AMT,A.OST_FC_AMT))- DECODE(PARA_VALUE,PARA_VALUE,SUM(NVL(B.OST_LC_AMT,0)),
    SUM(NVL(B.OST_FC_AMT,0)))) * DECODE(A.OST_DRCR_FLAG, 'D',1,-1)),0) BAL_AMT FROM FM_TRANSACTION,
    FM_COMPANY,FM_SUPPLIER,FM_CUSTOMER,FM_CURRENCY,FP_PARAMETER,FT_OS B, FT_OS A WHERE A.OST_COMP_CODE = 'EPM'
    AND A.OST_MAIN_ACNT_CODE BETWEEN RTRIM('1140101') AND RTRIM('1140101') AND A.OST_DOC_DT <= TO_DATE(P_FDT,'DD/MM/YYYY')
    AND (((NVL(A.OST_LAST_MATCH_DT,A.OST_DOC_DT)) > (TO_DATE(P_FDT,'DD/MM/YYYY')) AND NVL(A.OST_TYPE,'Z') = 'P') OR
    (TO_NUMBER(NVL(A.OST_LC_AMT,0)) != TO_NUMBER(NVL(A.OST_LC_ADJ_AMT,0))) OR (TO_NUMBER(NVL(A.OST_FC_AMT,0)) != TO_NUMBER(NVL(A.OST_FC_ADJ_AMT,0))))
    AND NVL(A.OST_TYPE,'Z') IN ('P','Z') AND B.OST_REF_KEY_NO (+) = A.OST_KEY_NO
    AND B.OST_TYPE (+) = 'R' AND B.OST_DOC_DT (+) <= TRUNC(TO_DATE(P_FDT,'DD/MM/YYYY'))
    AND PARA_ID = 'BASE.CURR' AND CURR_CODE = PARA_VALUE
    AND SUPP_CODE(+) = NVL(A.OST_SUB_ACNT_CODE,'*') AND CUST_CODE(+) = NVL(A.OST_SUB_ACNT_CODE,'*')
    AND EXISTS (SELECT 'X' FROM FM_CUSTOMER X WHERE X.CUST_CODE = A.OST_SUB_ACNT_CODE
    UNION SELECT 'X' FROM FM_SUPPLIER Y WHERE Y.SUPP_CODE = A.OST_SUB_aCNT_CODE)
    AND TRAN_CODE = A.OST_TRAN_CODE AND COMP_CODE = A.OST_COMP_CODE
    GROUP BY A.OST_KEY_NO,A.OST_SUB_ACNT_CODE,A.OST_DOC_DT,A.OST_DUE_DT,A.OST_TRAN_CODE,A.OST_DOC_NO,
    A.OST_LC_AMT, A.OST_FC_AMT,A.OST_LC_ORG_AMT,A.OST_FC_ORG_AMT,A.OST_TYPE,A.OST_DRCR_FLAG,A.OST_DOC_REF,
    PARA_VALUE,A.OST_SM_CODE;
    begin
         if c1%isopen then
         close c1;
         end if;     
         open c1;
         fetch c1 into p_ret;
         return p_ret;
    end;
    Please note that the SELECT statement if i execute in Toad, it is giving me the correct result.Whats wrong in this code ??? Can anyone help me ...

    If you could edit your first post to change the subject line to include [SOLVED], that would be helpful.
    Once I'd copied your query into a formatting tool it was much easier to read and hence the solution was pretty obvious. Worth remembering to format code - and preserve formatting when posting to the forum by wrapping your code in [code] and [/code] tags as I did in my response.

  • Function to run conditional on CSV and delete line if true

    It's Friday and my brain is focusing more on the weekend than work, so I ask your help, oh PowerShell community:
    I've been tasked with converting our old VB new user script to Powershell, the input of which is a CSV that HR sends us on a daily basis. On rare occasion they include someone who already exists as a user, and I'd like to write a function to check the CSV
    for that and remove that line in the CSV before continuing processing. So far I have the following:
    Function Clear-Existing
    param
    [string]$path
    $csv_input = import-csv -Delimiter ',' $path -Header @("EmpID","LastName","FirstName","Title","Dept","Status") | % ( $_.EmpID
    foreach ($entry in $csv_input)
    if (Check-ADUser $entry.EmpID -eq $true)
    write-host "user $entry already exists!"
    But being said Friday, I can't figure out how to remove the "offending" line from the CSV and save it.
    [email protected]

    Try something like this, you may want to change the path on the Export-Csv file to verify first, so that way you don't overwrite your file
    Function Clear-Existing
    param
    [string]$path
    $results = @()
    import-csv -Delimiter ',' $path -Header @("EmpID","LastName","FirstName","Title","Dept","Status") | ForEach {
    if (Check-ADUser $_.EmpID -eq $true)
    write-host "user $entry already exists!"
    else
    $results += $_
    $results | Export-Csv $path
    If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful.
    Don't Retire Technet

  • Call stored function return array

    Hi all,
    I have a function as follow:
    create or replace TYPE string_table IS TABLE OF VARCHAR2(2000);
    create or replace TYPE ARRAYTYPE is VARRAY(20) OF VARCHAR2(30);
    create or replace FUNCTION getEmpArray(s varchar2, t varchar2, st string_table) RETURN ARRAYTYPE AS
    l_data ARRAYTYPE := ARRAYTYPE();
    BEGIN
    l_data.extend; l_data(l_data.count) := s; l_data.extend; l_data(l_data.count) := t; l_data.extend; l_data(l_data.count) := st(1); RETURN l_data;
    END;
    I want to call this function by StoredFunctionCall
    code:
    StoredFunctionCall fun = new StoredFunctionCall();
    fun.setProcedureName("getEmpArray".toUpperCase());
    Object[] arr = new Object[]{"aa", "fgfg", "bbb"};
    ArrayDescriptor arrDescriptor =
    ArrayDescriptor.createDescriptor("string_table".toUpperCase(),
    connection);
    ARRAY arrayToPass = new ARRAY(arrDescriptor, connection, arr);
    fun.addUnamedArgumentValue("a");
    fun.addUnamedArgumentValue("b");
    fun.addUnamedArgumentValue(arrayToPass);
    fun.setResult("FUNCTION_RESULT"); // for get result by this name
    Vector<DatabaseRecord> list = session.executeSelectingCall(fun);
    But Exception
    PLS-00382: expression is of wrong type
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Error Code: 6550
    Call: BEGIN ? := GETEMPARRAY(?, ?, ?); END;
         bind => [=> FUNCTION_RESULT, a, b, oracle.sql.ARRAY@21fbc01]
    Please help me
    Edited by: fbg on 21:52 26-04-2010

    A few issues,
    1 - JDBC does not support the PLSQL TABLE type, you must use a VARRAY type, or wrap the TABLE function call in a function that takes a VARRAY.
    TopLink also has support for PLSQL types in its PLSQLStoredProcedureCall class, but no support is currently offered for StoredFunctions.
    You can't pass the VARRAY type for the TABLE argument.
    2 - Your function returns a VARRAY, so you need to define this type in the StoredFunctionCall result.
    We don't currently expose the API to set a Array type for the result, so you would need to access the call's first parameter directly, or use a StoredProcedureCall (and convert your function to a procedure).
    You may also wish to investigate returning a cursor from a stored procedure instead of the varray.
    You could also access the JDBC connection directly and perform the call using JDBC code.
    Feel free to log these issues in EclipseLink.
    James : www.eclipselink.org

  • Select from function return rowtype @ db link

    Hi, I am trying to select a row from a function which return a row type @ another DB.
    First DB
    ==========
    Function: fn_something(params) return mytable@snddb%rowtype
    DB Link: snddb
    Second DB
    ==========
    Table: mytable (Column: mycol)
    I have tried to execute query
    select fn_something(params) from dual
    OR
    select mycol from table(fn_something(params))
    but I have got "invalid datatype" error.
    What would be the correct syntax for my query? Thanks.

    Hi Andy,
    Thanks for your reply.
    My function itself has no problem and has been using for a while.
    The function return a rowtype(a table row) and it is using in a stored procedure.
    It could be done in stored procedure but I would like to know if I could call it directly from a query.
    I have just read another thread
    Help - Oracle function w/RETURN VIEW_NAME%ROWTYPE
    which is quite similar to mine
    but I am trying to get a column value from the function and execute an insert statement.
    Could I do it without wrapped by begin end ?

  • Applescript returns incorrect value with blank cell

    Imagine there is a column of numbers, some which might have the value 0.0 and some which are blank. Imagine wanting to append a data set at the first blank cell using Applescript. As Applescript is currently implemented in Numbers, this is not possible. See the following test.
    1. In Numbers, create a new blank spreadsheet.
    2. Select cell "A1".
    3. Format as text.
    4. Execute the following line of Applescript,
    tell application "Numbers" to get value of cell "A1" of table 1 of sheet 1 of front document
    It returns "0.0".
    I would expect a return "" since it is a empty cell formated as text, no less.
    Because of this, there is no way to find a blank cell since a blank cell returns a value of 0.0 which might be a valid entry.
    Anyone have any ideas for a work around?

    The value of a blank (empty) cell IS zero.
    The value of a cell containing a string whose length is zero contains "".
    Given that, I will post a report because I'm not sure than the value returned in AppleScript is the good choice.
    In AppleWorks for a blank cell, the returned value was "".
    Yvan KOENIG (from FRANCE dimanche 11 janvier 2009 16:31:35)
    +Your tracking number for this issue is Bug ID# 6487875.+
    Hello
    +(1) May I know if the fact than+
    +set v to value of cell "B12"+
    +returns 0.0 when the cell is blank is the designed result.+
    +In AppleWorks in this case, we are accustomed to get an empty string.+
    +(2) In version 1, a cell containing an empty string was accepted in an arithmetic operation.+
    +In version 2, it is rejected.+
    +Is it a design choice or is it a bug ?+
    +Your tracking number for this issue is Bug ID# 6487879.+
    Hello
    +In Numbers, as long as we are referencing cells of the current row (200 for instance), we may use short references like:+
    =(BC)*(DE)
    +When we save as iWork '08 document, the formula is expanded as+
    =(B200C200)*(D200E200)
    +Is it a design choice or a bug ?+

  • Dynamic Column Headings - Function returning colon delimited column list

    I created a SQL report using the report wizard.
    In the report options, I chose a heading type of:
    Function returning colon delimited list of columns
    I then wrote a function that returns a VARCHAR2 string.
    I return a string like this...
    Jan-04:Jan-11:Jan-18:Jan-25:Feb-01
    In the text area labeled "Function returning colon delimited list",
    I simply entered the name of the function, in this case,
    the name is "WeekHeader".
    When I execute the report, I get this error:
    unable to determine query headings:
    ORA-06550: line 1, column 45:
    PLS-00221: 'WEEKHEADER' is not a procedure or is undefined
    ORA-06550: line 1, column 45:
    PL/SQL: Statement ignored
    failed to parse SQL query:
    How can I get the report to use my function?

    all you need to do is put the word "return" in front of your function name, and you should be good to go. before you say it, i'll acknowledge that we should probably be more clear about the syntax for that field, so i'll log the enhancement request.
    hope this helps,
    raj

  • How can a function return a constant reference to an object

    how can a function return a constant reference to an object so that the calling party dont have rights to change it.
    like this example
    class obj = somefunc();
    obj.changeit(); // this line lust give error saying that its read only..
    somefunc()
    return criticalobj;
    in c++ we can achieve this by using the const pointer to the object.. how can we do this in java???

    arun160411 wrote:
    in c++ we can achieve this by using the const pointer to the object.. how can we do this in java???Of course the first thing anyone learns about const pointers is how to cast away constness, so this is completely useless, up there with the chastity movement's thong underwear with the stop sign on it. If you can read this, you're too close!

Maybe you are looking for

  • IPhone Contacts won't let me "add to favorite"

    I have an iPhone 3g - not the newest version - with the new 3.0. When I go into Contacts and then find a contact I want to add as a favorite, the only options it displays is "Text Message" or "Share Contact". There is no "add as favorite". What gives

  • Hp LaserJet P3015 randomly miss prints random letters.

    Hi I wonk as a It technician in a College environment. We have a computer lab with 40 Dell OptiPlex 390's connected via a local area network to a Hp Laser Jet P3015. The students have to use a water mark during exams as a way to identify on witch com

  • Technical Issues

    Hello everybody, <br> <br> We are having an issue right now and we need your help. <br> <br> In our client enviroment is not installed even the EHP1 level for Basis or Abap and this is necessary for install the version 6.0 <br> <br> We read that ther

  • Adobe Exchange for After Effects?

    The old Adobe exchange is gone. I tried to download the exchange extention, and it seems to work fine for photoshop and illustrator. It seems, howerver that there is no exchange for After Effects. What heppend to all those nice scripts and pixel bend

  • HP Pavillion DM4 Notebook PC Webcam not working

    HP Pavillion DM4 Notebook PC  Windows 7 64-Bit I have had problems with this webcam from day one. I will turn it on, it will display for a few seconds, freeze, and then display this message. I have updated my drivers. Any ideas?