Result may contain single string or comma separated need to split into rows

Hi, All... I've searched through the forums and found plenty on splitting comma separated into rows; though I'm struggling applying it to my situation. I have data that looks like the below where I need to split a value into multiple rows if it should be but the same field in the table may also contain a string that should not be separated (indicated by the "Array" field being 0 or 1)...
WITH t AS
(SELECT 1 as array, '"Banana", "Apple", "Pear"' as str FROM dual union all
SELECT 0, 'Fruit is delicious' FROM dual union all
SELECT 0, 'So are vegetables' FROM dual union all
SELECT 1, '"Bean", "Carrot", "Broccoli"' FROM dual union all
SELECT 1, '"Apple", "Banana"' FROM dual)I've looked through many of the connect_by posts on the forum and I haven't come across one that splits a field if it should be but doesn't if it should not be... may have missed it because there are plenty of these requests on the forum!
If you're feeling even more ambitious - the ultimate goal is to count the number of times a particular answer appears in an array - so notice the last portion of the data contains "Apple", "Banana"... the result would show:
RESULT
Banana             2
Apple              2
Pear               1
Bean               1
Carrot             1
Broccoli           1
Fruit is delicious
So are vegetablesI can always sort them later based on other fields in the table - but the result above would be my ultimate goal!
Any help is always appreciated. Thanks! 11g

Hi,
The examples you found should work for you. Just use a CASE expression to determine if str needs to be split or not, by looking at array.
Here's one way:
WITH     got_part_cnt     AS
     SELECT     array, str
     ,     CASE
              WHEN  array = 0
              THEN  1
--              ELSE  1 + REGEXP_COUNT (str, '", "')     -- See note below
              ELSE  1 + ( ( LENGTH (str)
                              - LENGTH (REPLACE (str, '", "'))
                     / 4
          END          AS part_cnt
     FROM    t
,     cntr     AS
     SELECT  LEVEL     AS n
     FROM     (
              SELECT  MAX (part_cnt)     AS max_part_cnt
              FROM    got_part_cnt
     CONNECT BY     LEVEL     <= max_part_cnt
,     got_sub_str          AS
     SELECT     CASE
              WHEN  p.array = 0
              THEN  p.str
              ELSE  REGEXP_SUBSTR ( p.str
                               , '[^"]+'
                         , 1
                         , (2 * c.n) - 1
          END     AS sub_str
     FROM     got_part_cnt  p
     JOIN     cntr           c  ON  c.n <= p.part_cnt
SELECT       sub_str
,       COUNT (*)     AS cnt
FROM       got_sub_str
GROUP BY  sub_str
ORDER BY  cnt          DESC
,            sub_str
{code}
The only database at hand right now is Oracle 10.2, which doesn't have REGEXP_COUNT.  I had to use a complicated way of counting how many times '", "' occurs in str in order to test this in Oracle 10.  Since you have Oracle 11, you can un-comment the line that uses REGEXP_COUNT in the first CASE expression, and remove the alternate ELSE clause (that is, the next 5 lines, up to END).
To make sure that this query is really paying attention to array, I added this row to the sample data:
{code}
SELECT 0, '"Bean", "Carrot", "Broccoli"' FROM dual union all
{code}
Even though str looks just like a delimited list, array=0 tells the query not to split it, so it produces these results:
{code}
SUB_STR                               CNT
Apple                                   2
Banana                                  2
"Bean", "Carrot", "Broccoli"            1
Bean                                    1
Broccoli                                1
Carrot                                  1
Fruit is delicious                      1
Pear                                    1
So are vegetables                       1
{code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • SQL - Multiple Fetch into Single Column with Comma Separator

    Hello Experts,
    Good Day to all...
    I need your help on following scenarios. The below query returns set of titleID strings. Instead of printing them one below the other as query output, I want the output to be in batch of 25 values.i.e each row should have 25 values separated by comma. i.e If there are 100 titles satisfying the output, then there should be only four rows with and each row having 25 titles in comma separated manner.
    SELECT DISTINCT title_id
               FROM pack_relation
              WHERE package_id IN (      SELECT DISTINCT fa.package_id
                                                    FROM annotation fa
                                                GROUP BY fa.package_id
                                                  HAVING COUNT
                                                            (fa.package_id) <100);I tried with the PL/SQL block; whereas it is printing all the values continously :(
    I need to stop with 25 values and display.
    If its possible with SQL block alone; then it would be of great help
    DECLARE
       v_str   VARCHAR2 (32767)  := NULL;
       CURSOR c1
       IS
         SELECT DISTINCT title_id
               FROM pack_relation
              WHERE package_id IN (      SELECT DISTINCT fa.package_id
                                                    FROM annotation fa
                                                GROUP BY fa.package_id
                                                  HAVING COUNT
                                                            (fa.package_id) <100);
    BEGIN
       FOR i IN c1
       LOOP
          v_str := v_str || ',' || i.title_id;
       END LOOP;
       v_str := SUBSTR (v_str, 2);
       DBMS_OUTPUT.put_line (v_str);
    EXCEPTION
       WHEN OTHERS
       THEN
          DBMS_OUTPUT.put_line ('Error-->' || SQLERRM);
    END;Thanks...

    You can use CEIL
    Sample code
    SELECT
        nt,
        LTRIM(MAX(SYS_CONNECT_BY_PATH(val,',')) KEEP (DENSE_RANK LAST ORDER BY curr),',') AS concat_val
    FROM
            SELECT
                val,
                nt,
                ROW_NUMBER() OVER (PARTITION BY nt ORDER BY val)    AS curr,
                ROW_NUMBER() OVER (PARTITION BY nt ORDER BY val) -1 AS prev
            FROM
                    SELECT
                        level                          AS val,
                        ceil(rownum/3)  as nt /* Grouped in batches of 3 */
                    FROM
                        dual
                        CONNECT BY level <= 10
    GROUP BY
        nt
        CONNECT BY prev = PRIOR curr
    AND nt              = PRIOR nt
        START WITH curr = 1;
            NT CONCAT_VAL
             1 1,2,3
             2 4,5,6
             3 7,8,9
             4 10Your code
    SELECT
        nt,
        LTRIM(MAX(SYS_CONNECT_BY_PATH(title_id,',')) KEEP (DENSE_RANK LAST ORDER BY curr),',') AS concat_val
    FROM
            SELECT
                title_id,
                nt,
                ROW_NUMBER () OVER (PARTITion BY nt ORDER BY title_id)   AS curr,
                ROW_NUMBER() OVER (PARTITION BY nt ORDER BY title_id) -1 AS prev
            FROM
                    SELECT
                        title_id,
                        ceil(rownum/25) AS nt /* Grouped in batches of 25 */
                    FROM
                        pack_relation tdpr
                    JOIN annotation fa
                    ON
                        tdpr.package_id = fa.package_id
                    GROUP BY
                        title_id,
                        fa.package_id
                    HAVING
                        COUNT (fa.package_id) < 500
    GROUP BY
        nt
        CONNECT BY prev = PRIOR curr
    AND nt              = PRIOR nt
        START WITH curr = 1;

  • SharePoint 2013 - Split comma separated Column in to different row items in SharePoint 2013 Workflow or Event Handler

    I have a requirement to take a String column that allows multiple fields i.e. "101;102,103,104",
    and using a SPD 2013 workflow I want to split there values and then insert each Values into different list as separate items.
    Eg:
    I have a LIST A with the columns CustID, CustName and LIST B with the same Column Name with the below values
    LIST A:
    Cust ID
    CustName
    101
    ABC, XYZ, CTSS, WIPROS, TCSS
    I want to insert the above comma separated values in the below format(different Row)
    LIST B:
    CustID
    CustName
    101
    ABC
    101
    XYZ
    101
    CTSS
    101
    WIPROS
    101
    TCSS

    Hi,
    Here is a codeplex solution can meet your reference:
    Plumsail String Workflow Actions for SharePoint 2013 and SharePoint Online
    http://spworkflowactions.codeplex.com/
    We can use Split string workflow action to split the CustName value, then insert it to ListB.
    More information:
    http://www.codeproject.com/Articles/749471/String-processing-workflow-actions-for-SharePoint
    Best Regards
    Dennis Guo
    TechNet Community Support

  • Displaying data from a list into a single field with comma separated values

    Hi,
    I have a requirement to change a report with an XML structure (simplified version) as below
    <Protocol>
    <ProtocolNumber>100</ProtocolNumber>
    <SiteName>Baxter Building</SiteName>
    <ListOfActivity>
    <Activity>
    <Description>Communication Memo Description.</Description>
    <Name>James</Name>
    </Activity>
    <Activity>
    <Description>Visit 4</Description>
    <Name>James</Name>
    </Activity>
    <ListOfActivity/>
    </Protocol>
    On the report I need to display all the 'Names' for each of the Child (Activities) in a single field at the Parent (Protocol) level, with each Name separated by a comma.
    How do I go about getting this to work?
    Thanks

    Take a look at this: http://blogs.oracle.com/xmlpublisher/entry/inline_grouping
    You could do this (ofcourse, you will need to add extra logic to ensure that there is no comma added after the last name..)
    <?for-each@inlines:Name?><?.?><?', '?><?end for-each?>
    Thanks,
    Bipuser

  • Field with comma separated values to be split into Rows using a Query

    Thanks for the Reply.. I also have to Decode each of the spilt values with some text..
    replace(disc_topics,',',chr(10)) A from XYZ
    Disc_topics values are '01,02,03,04,05'
    this has to be done in SQL
    01 Test1
    02 Test2
    03 Test3
    04 Test4

    select replace( replace( replace( replace( '#' || '01,02,03,04,05,10,11', ',', ',#'), '#0','#'),'#','Test'),',',chr(10)) A from XYZ

  • Parse String, split into rows

    I have a report who has the following output:
    MODEL    PO No   RR No  RR Date,     PartNo           Part Description,              Qty Received   Lot No             DR No.    DR Date     
    QB3-DLX  150     100455  3/16/2011   657712S400   ROD HOOD SUPPORT       72                  252-36,253-36 2345       3/15/2011
    based on the Lot No column result would be:
    MODEL    PO No    RR No    RR Date     PartNo           Part Description              Qty Received    Lot No           DR No.    DR Date     
    QB3-DLX  150      100455   3/16/2011  657712S400  ROD HOOD SUPPORT       36                   252-36           2345      3/15/2011
    QB3-DLX  150      100455   3/16/2011  657712S400  ROD HOOD SUPPORT       36                   253-36           2345      3/15/2011
    How will I parse the Lot No column and have the following result displayed as above?
    Thank you in advance.

    Hi,
    You may do the opposite: i.e. from 2 lines to one. It will be extremely difficult or not possible to meet your above need.
    Thanks,
    Gordon

  • Replacing multiple strings for many occurance of single string   in OBIEE a

    Hi,
    I have a requirement like i need to replace a Particular string('_') that occur three times in a string.I need to replace different strings for each occurance of ('_').
    My requirement is like this,
    My string is 'A_B_C_D' and I need to replace first'_' as 'E=' second '_' as 'F=' third '_' as 'G='.
    and the final string should be I=A E=B F=C G=D...
    Can any one help me in the logic or else help me how to use the existing functions in answers.

    Hi,
    We have Replace function in Answers which would replace all occurunces of a particular character with another. To achieve your requirement, you will need to split your string and apply replace function on each part and finally concatenate again.
    For e.g. your string is 'A_B_C_D'
    You need to split into, below
    A_
    B_
    C_
    D
    Apply Replace function to first three parts and then finally concatenate.
    Replace('A_','_','E=') || Replace('B_','_','F=') || Replace('C_','_','G=') || 'D'
    To split the string into parts you may have to use substring and locate functions.
    Refer the below thread too.
    Re: extract a part of a string in a full  string
    Thanks

  • Remove Duplicates From Comma Separated String

    Hi,
    I have one Column which contains duplicates values with comma separated.
    Customer ID
    5,5,5,5,6,6,5,5,5,6,7,4,1,2,1,4,7,2
    I wrote this:
    select REGEXP_REPLACE('5,5,5,5,6,6,5,5,5,6,7,4,1,2,1,4,7,2', '(^|,)([^,]*)(,\2)+','\1\2') from dual;
    5,6,5,6,7,4,1,2,1,4,7,2
    But it eliminates only continuous elements.
    I want out put like:
    5,6,7,4,1,2
    Please help.
    Thanks.
    Amit
    Edited by: 987565 on Feb 12, 2013 4:02 AM

    Thanks Purvesh,
    While testing with real data, it is ignoring some values. I didn't understand why it happening.
    with data as
    select '5714,5714,5714,5714,5714,5714,5714,5714,5714,5714,5714,5714,5668,5716,5714,5714,5714,5714,5714,5714,5714,5714,5714,5714,5714,5714,5668,5716' col from dual
    select ltrim(max(sys_connect_by_path(col, ',')) keep (dense_rank last order by rn - 1), ',') col
    from (
    select col, row_number() over (order by 1) rn
    from (
    select distinct regexp_substr(col, '[^,]+', 1, level) col
    from data
    connect by level <= length(col) - length(replace(col, ','))
    start with rn = 1
    connect by prior rn = rn - 1;
    Result I got is:
    5714,5714,5716
    My Real Query is like that:
    declare
    cursor c1 is
    select o.id id
    from order o;
    v_char varchar2(200) := '';
    begin
    for a1 in c1 loop
    with data as
    select o.cust_id as col into v_char
    from order o
    where o.id = a1.id
    select ltrim(max(sys_connect_by_path(col, ',')) keep (dense_rank last order by rn - 1), ',') col
    from (
    select col, row_number() over (order by 1) rn
    from (
    select distinct regexp_substr(col, '[^,]+', 1, level) col
    from data
    connect by level <= length(col) - length(replace(col, ','))
    start with rn = 1
    connect by prior rn = rn - 1;
    SYS.dbms_output.put_line(v_char);
    end loop;
    end;
    Later, i will update same cust_id with v_char.

  • Get Comma separated result from SQL Query

    Hey Everyone
    I have a requirement where i need to get comma separated result of names because there is one to many relationship i.e for every protocol there are mutiple people associated to it , and i created PL/SQL function for that and everything was fine and when it is in production multiple number of cursors were opened because of the logic and leading to RAC fail over and for that we were manually clearing the cursors every weekend and i am looking to create a Materialized view for this logic but i was unable to code the logic using Connect by clause
    Result is like and i want comma separated names for every protocol
    P06065     TESTER13 TESTER13
    P02095     PATRICIA CARMELITANO
    P02095     ANNE MUIR
    P02095     ROBERT HARLOW
    P02095     JANICE ALBERT
    P02095     Jacqueline van Dalen
    P02095     GUENTER HENNIG DR.
    P05209     Olga Xenaki
    P05553     Birgit Limbach-Angele
    P05553     Anja Schulz Dr.
    P05553     CHRISTA HAGENBUCHER
    here is the function which i wrote, i need to get the same logic through SQL Statement .. thanks for your help
    cursor c_GSCR is
    select T565804.FST_NAME||' '||T565804.LAST_NAME
    from
    S_PT_POS_HST_LS T544105 /* S_PT_POS_HST_LS_Protocol_Team */ ,
    S_CONTACT T565804 /* S_CONTACT_Protocol_Team */,
    S_CL_PTCL_LS T541903 /* S_CL_PTCL_LS_Protocol */
    where ( T541903.ROW_ID = T544105.CL_PTCL_ID and
    T544105.POSTN_ID = T565804.PR_HELD_POSTN_ID and
    T544105.ROLE_CD = 'Lead Project Manager' AND
    T541903.ROW_ID = v_PTCL_ID and
    T541903.PAR_PTCL_ID is null and T544105.END_DT is null );
    BEGIN
    l_row_num := 0;
    l_role := '';
    l_role_list := '';
    v_PTCL_ID := PTCL_ID;
    OPEN C_GSCR;
    if C_GSCR%isopen THEN
    LOOP
    FETCH C_GSCR INTO l_role;
    exit when C_GSCR%notfound;
    IF l_role_list IS NULL THEN
    l_role_list:=l_role;
    ELSE
    l_role_list:=l_role_list||', '||l_role;
    END IF;
    END LOOP;
    CLOSE C_GSCR;
    end if;
    ~Srix

    Hi,
    Srix wrote:
    Thanks for the Info .. My database in 10g R 2 i started using COLLECT Function
    select T541903.PTCL_NUM ,
    CAST(COLLECT(T565804.FST_NAME||' '||T565804.LAST_NAME) AS varchar2_ntt) , 7) AS LPM_NAME
    from
    S_PT_POS_HST_LS T544105 /* S_PT_POS_HST_LS_Protocol_Team */ ,
    S_CONTACT T565804 /* S_CONTACT_Protocol_Team */,
    S_CL_PTCL_LS T541903 /* S_CL_PTCL_LS_Protocol */
    where T541903.ROW_ID = T544105.CL_PTCL_ID and
    T544105.POSTN_ID = T565804.PR_HELD_POSTN_ID and
    T544105.ROLE_CD = 'Lead Project Manager' AND
    T541903.PAR_PTCL_ID is null and T544105.END_DT is null
    GROUP BY T541903.PTCL_NUM
    The result i like ...Do you mean "The result *is* like ..."?
    Or do you mean "The result I [would] like [is] ..."?
    The code above has unblanaced parentheses. If you are getting anything other than an error message, then I don't believe you are really running what you posted.
    Whenever you have a problem, post a complete test script that people can use to recreate the problem and test their ideas.
    Please do that. Post CREATE TABLE and INSERT statements to crate the sample data, the code you used to create the carachr2_ntt type and the function, and your best attempt at a query (formatted). Simplify as much as possible. For example, do you really need 3 tables to illustrate the problem? For purposes of asking a question on this forum, can't you pretend you have just one table, with 2 columns?
    I suspect the problem has to do with the user-defined type and function, which you didn't post. I can't even see how you called the function in your query. Without the information I mentioned above, there's not much I can do to help you.

  • Comparing 2 comma separated value strings

    Hi
    I've the following requirement where i need to comapre 2 strings having comma separated values.
    declare
    v_Str1 varchar2(100) ;
    v_str2 varchar2(100);
    begin
    v_str1 := '123,234,456' ;
    v_str2 := '123,234';
    /*  *I need to write a logic to compare the above 2 strings
    Could you please give me  hint to achieve this*  */Thanks
    Edited by: smile on Mar 13, 2012 8:20 PM

    Try this
    declare
    v_Str1 varchar2(100) ;
    v_str2 varchar2(100);
    begin
    v_str1 := '123,234,456,4364' ;
    v_str2 := '123,234';
    For cur_rec in (
      select REGEXP_SUBSTR (v_str1, '[^,]+', 1, level) output
      from t
      connect by level <= regexp_count(v_str1,',')+1
      MINUS
      select REGEXP_SUBSTR (v_str2, '[^,]+', 1, level) output
      from t
      connect by level <= regexp_count(v_str2,',')+1) loop
      DBMS_OUTPUT.PUT_LINE(cur_rec.output);
    End loop;
    End;
    4364
    456
    PL/SQL procedure successfully completedAnother format
    declare
    v_Str1 varchar2(100) ;
    v_str2 varchar2(100);
    v_Str3 varchar2(100);
    begin
    v_Str1 := '600,100,500,200,300,400' ;
    v_Str2 :='100,200';
    For cur_rec in (
      select REGEXP_SUBSTR (v_str1, '[^,]+', 1, level) output
      from t
      connect by level <= regexp_count(v_str1,',')+1
      MINUS
      select REGEXP_SUBSTR (v_str2, '[^,]+', 1, level) output
      from t
      connect by level <= regexp_count(v_str2,',')+1) loop
      v_Str3:=v_Str3||','||cur_rec.output;
    End loop;
      v_Str3:=LTRIM(RTRIM(v_Str3,','),',');
      DBMS_OUTPUT.PUT_LINE(v_Str3);
    End;
    300,400,500,600
    PL/SQL procedure successfully completedEdited by: Lokanath Giri on १४ मार्च, २०१२ १:३३ अपराह्न

  • How to seach for a particular text in comma separated values

    Hi,
    I have one table for eg. TB_Fruits.
    In that i have one column FruitsName(Varchar)
    In that column i am storing string in comma separated values.
    Select FruitsName from tb_fruits;
    Result: orange,banana,apple
    Now the issue is suppose if i try to insert any of these fruits name again then it should not allow me to insert.
    Suppose now if i try to insert ('grapes,banana')
    or
    ('apple,grapes')
    the orange,banana,apple can be in any position.
    How to check if any of these names already exist or not in the column fruitsname?
    I cannot use like or INstr function here. because the position is not fixed not even string.
    Appreciate any help.

    After doing search.
    Got to know <= 3 length in word is in stoplist.
    That's why the value ALL it was not searching in index.
    After modifying the index this problem is solved.
    CREATE INDEX
    Fruitsname_idx ON tb_fruits (FruitsName)
    indextype is ctxsys.context
    PARAMETERS('SYNC ( ON COMMIT)
    stoplist ctxsys.empty_stoplist');
    But now the issue is suppose i have value with space..
    i inserted one more row with value 'FRUITS YELLOW'
    So in the index it is storing two rows....one is for FRUITS and second is for YELLOW.
    select * from tb_fruits t where contains(t.FruitsName,'FRUITS')>0
    I will get record..but actually there should be no record.
    And it should allow me to insert. So i can insert the value FRUITS in more row.
    Any help on how to store the value with space in one row in index??

  • Comma separated data to array

    I am looking for a method to translate a string with comma separated data into an array or vector.

    Hello rolivawdaneel, I hope this help you, this takes the string a returns a vector.
    import java.util.StringTokenizer;
    import java.util.Vector;
    public class stringConverter {
        public static Vector toVector( String s ) {
            Vector result = new Vector();
            StringTokenizer st = new StringTokenizer( s, "," );
            while( st.hasMoreTokens() ) {
                String aTokenizedString = st.nextToken();
                result.addElement( aTokenizedString );
            return result;
    }

  • File content conversion: String with commas to CSV

    Hi Experts,
    I have the following structure
    DATA (1..n)
    ...Result (1..1)
    The Result field contains a string like below
    a,b,c,d,e,f,g,h,i,j
    How do I put this into File Content Conversion when I want the receiver to be a CSV file? One cell per letter.
    Thanks in advance.

    Outbound: you could convert your flat file to xml at first. Make the necessary mapping to the destination structur.
    http://www.riyaz.net/blog/xipi-file-content-conversion-for-simple-structure/
    Inbound: Content convernsion from xml to csv.
    /people/arpit.seth/blog/2005/06/02/file-receiver-with-content-conversion
    /people/venkat.donela/blog/2005/03/03/introduction-to-simple-file-xi-filescenario-and-complete-walk-through-for-starterspart2
    /people/anish.abraham2/blog/2005/06/08/content-conversion-patternrandom-content-in-input-file
    Cheers
    Serdar

  • SUM function resulting WRONG values when some cell contains a string

    A very strange problem that can result in wrong financial calculations and big mistakes...
    If we have SUM function for some range of cells and one of them is treated as text string (I mean it's number in fact but Number is sure it's text string). than SUM function calulates ALL cells except this sell silently without errors and results in wrong result.
    For example we have cells and values
    A B
    =====
    1| 15 USD
    2| 0 USD
    3| 37 USD
    4| 1 USD
    5| 3 USD
    here the function SUM(B1:B5) should provide the result "56 USD"
    But if cell B5 is treated as text string (it can be still displayed as "3 USD" so we don't know it's treated as text string for some reason) than SUM(B1:B5) swill answer "53 USD".
    The problem is we DON'T know cell B5 is treated as text and we are fully sure that we have the correct sum of all 5 cells, in reality we see sum of 4 cells only....
    I think anybody working with financial or other important data can imagine how dangerous this SUM behaviour is.... I encountered several times that when importing data from Excel or by other ways numbers are imported as text strings. So if I have a lot of cells I'm not sure if all those cells are correctly styled or some of them for some unknown reason is treated as text string.
    In Microsoft Excel there is a very right solution. In MS Excel if any cell in the SUM is wrong format the SUM function simply provides error as a result. But in Numbers SUM doesn't tell us about error, it simply provides us with a wrong result!
    With formal logic the way SUM works in Numbers is total idiotism. If I ask to SUM B1:B5 than I definitely ask to sum ALL 5 cells, not 4, not 3, not 6 but 5 definite cells. If Numbers can't sum those exactly those 5 cells the only answer of the function should be ERROR.
    But Apple Numbers answers me some result of summing those cells that it's able to sum. Apple Numbers SUM function is not confused that I asked for SUM of 5 (not 4 or 3) cells and I expect to have this sum as a result.
    In fact Apple uses the right logic when we use another formula. If we use =B1B2+B3+B4B5 and any cell contains text string that we'll have error result the sam as in Microsoft Excel. So in this example Numbers behaves correctly.
    So why SUM (B1:B5) can provide totally different result as =B1B2+B3+B4B5?

    alexb2 wrote:
    So when I set format for my number as my local currency it's displayed as 123 XXX (XXX is my currency but it's not in latin). I see it's not only displayed but also stored as 123 XXX. That's different from Excel that stores only numbers in cells and shows number with prefix or suffix - Numbers storex number with prefix or suffix.
    No, you get this behavior because the original sheet is displaying values as currencies. I assumes that the import process pass it as a string because he doesn't recognize it as a currency value. As far as I know, Numbers stores the currency entries as a pure number and an indicator of the used currency.
    Here is an example.
    (a) the description of the numerical value (I underlined it: 456)
    <sf:number-cell sf:flags="4" sf:value="456" sf:col="1" sf:row="2">
    <sf:cell-style-ref sfa:IDREF="SFTCellStyle-46"/>
    <sf:content-size sfa:w="58.659881591796875" sfa:h="14"/>
    </sf:number-cell>
    (b) the description of the format (I underlined the used currency: XAM)
    <sf:cell-style sfa:ID="SFTCellStyle-46" sf:cell-style-default-line-height="12" sf:parent-ident="tabular-Basic-body-cell-style-id">
    <sf:property-map>
    <sf:SFTCellStylePropertyNumberFormat>
    <sf:number-format sfa:ID="SFTNumberFormat-23" sf:format-type="1" sf:format-string="#,##0.00 &#xA4;;-#,##0.00 &#xA4;" sf:format-decimal-places="2" sf:format-currency-code="XAM" sf:format-negative-style="0" sf:format-show-thousands-separator="true" sf:format-fraction-accuracy="-3" sf:format-use-accounting-style="false"/>
    </sf:SFTCellStylePropertyNumberFormat>
    <sf:SFTCellStylePropertyImplicitFormatType>
    <sf:number sfa:number="256" sfa:type="i"/>
    </sf:SFTCellStylePropertyImplicitFormatType>
    <sf:SFTCellStylePropertyFormatType>
    <sf:number sfa:number="257" sfa:type="i"/>
    </sf:SFTCellStylePropertyFormatType>
    </sf:property-map>
    </sf:cell-style>
    Of course, if the original currency string is not recognized, it can't be described as such a feature and the value is treated as a simple string.
    So may be at some moment my 123 XXX is treated like string value.
    Yes, find and replace is a nice tool when importing data - thanks for the tip. the last problem is with already Numbers files that were imported not today (or even createde as Numbers file) where some cell becomes string value after some editing.
    Here again, if you edit a currency string and replace it to a not recognized one, the result will be logically a string.
    There is an other way to give this result:
    copy a value from a cell formatted as XAM currency (just an example)
    paste it in a cell whose format is currency Euro (once again it's just an example).
    The result will be a string.
    The culprit is not the program, it's the user.
    I had several times this situation and last time I found error only because I have my budget in 2 programs - in Numbers and in another special budgeting program. As each program has advantages I have in fact 2 instances of the same budget.
    And when I changed some string in Numbers and another program I noticed the sum is different. I was sure it's another program somewhere buggy but noticed than Numbers simply ignores one of the budget strings and sums without it... In fact it was even not the string I changed, I remember I changed the buggy string about a week ago but I haven't compared budgets that time so my budget had a mistake for some time till I noticed it. If I used only Numbers without copy of budget in another program may be even today I won't notice the mistake.
    The same situation happened not once.
    I think that the choice made by Apple for SUM() is correct. You feel that it is wrong. It's useless to debate more, we will not change the behavior of the function.
    I try to give a workaround.
    The neater one is to add columns as I described in my first response.
    The given formula will clearly flag cells which aren't containing numerical values. If you move the SUM from the original range to the new one, the oddities will be flagged automatically.
    Here is an alternate workaround:
    The currency is XAM.
    In B4 I introduced a typo so the value is no longer a numerical one.
    Given that, the sum in the footer doesn't count the 34 (which is the normal behavior).
    In column C1 I entered =1*B
    which flagged the bad cell.
    The alternate is to use an auxiliary table like aux1
    In A1 I entered:
    =IF(ISERROR(INDIRECT(ADDRESS(ROW(),COLUMN(),,,"main"))),"",IF(ISBLANK(INDIRECT(A DDRESS(ROW(),COLUMN(),,,"main"))),"",1*INDIRECT(ADDRESS(ROW(),COLUMN(),,,"main") )))
    Exactly the same formula in B1, C1, D1, …
    So, the table will automatically grab the contents of the main table (just take care to insert more columns in aux1 than in main)
    In the footer row of aux1, insert a sum formula for columns where there is required.
    Looking at this footer will flag columns where a value may be "wrong" so, it will be necessary (but easy) to scan the column's content to find the red triangle(s).
    Yvan KOENIG (from FRANCE lundi 13 octobre 2008 13:27:40)

  • [svn] 1751: Bug: BLZ-174 - MessageClient.testMessage() is incorrectly doing a string compare for the subtopic header of an inbound message against the subtopic value (which may contain wildcards) that the Consumer is using.

    Revision: 1751
    Author: [email protected]
    Date: 2008-05-15 14:21:43 -0700 (Thu, 15 May 2008)
    Log Message:
    Bug: BLZ-174 - MessageClient.testMessage() is incorrectly doing a string compare for the subtopic header of an inbound message against the subtopic value (which may contain wildcards) that the Consumer is using.
    QA: No - customer verified the fix.
    Doc: No
    Ticket Links:
    http://bugs.adobe.com/jira/browse/BLZ-174
    Modified Paths:
    blazeds/branches/3.0.x/modules/core/src/java/flex/messaging/MessageClient.java
    blazeds/branches/3.0.x/modules/core/src/java/flex/messaging/services/MessageService.java

    If you create a metadatatype with a single metdata block, and you reference that in your vm/cm cell attribute using a *one* based index, Excel seems to see the link and it honors it when saving the spreadsheet.
    So, I ended up with something like:
    <c ... cm="1"/> (I'm dealing with cell metadata, but the concept is equivalente to value metadata)
    <metadataTypes count="1">
      <metadataType name="MyMetaType" .../>
    </metadataTypes>
    <futureMetadata count="1" name="MyMetaType">
      <bk>
        <extLst><ext
    uri="http://example" xmlns:x="http://example"><x:val>87</x:val></ext></extLst>
      </bk>
    </futureMetadata>
    <cellMetadata count="1">
      <bk><rc
    t="1" v="0"/></bk> <!-- this is what gets referenced as cm=1 on the cell -->
    </cellMetadata>
    Hope this helps. 

Maybe you are looking for

  • Why why why G4 TI4200 vtp use power ???

    Why I use G4 Ti4200 VTP my board power 3.3v will go down 3.02v ?? Tnt M64 didn't be this (3.2v in normal) And run 3D game it will go to 2.97+-v??? 400w powersuppy. Kt3 U2 6380e 256ddr ram 1800+ AMD XP

  • Help for RT PC timed loop in us?

    I have created realtime target  quadcore PC  and created a pulse pattern(500kHz) using DIO pin0.1 and both counters. I want to repeat the pattern or send manny patterns after 512us. I am using time loop. It is not providing more than 28ms however it

  • "close internet explorer" when trying to download

    I'm trying to download the latest version of adobe flash player. I have Windows 7 and Internet explorer 10. The message "close internet explorer" keeps popping up during the installation, even when explorer is closed. I'm not sure what to do.

  • HT4759 I was able to view "gallery" before this move.  What am I looking for now to view my photos?

    I was able to view gallery before the move.  What am I looking for now to post and view photos?

  • Sold iMac-Wiped HD-Reinstall Question

    Bought a new iRetina 27" and am selling my old 22" iMac.  I've zero wiped the HD and have reinstalled Yosemite and have reached the point where the setup process is pick the country.  I'm thinking I should power down here and leave the rest for the n