Compare two cells in a row and group of rows

Tuesdays 1st 2nd 3rd 4th 5th MB
Jan 4, 2011 7 14 21 28 36 32
Jan 11, 2011 5 15 25 28 38 16
Jan 18, 2011 2 17 25 28 38 25
Okay, say the above is my table, how do I compare two cells in a row for two numbers? Say I wanted to find out if row A2 contained a 7 and a 28?
I thought an IF formula might do it, but can't figure it out.
Thanks in advance!
Jim

Head Crab wrote:
Tuesdays 1st 2nd 3rd 4th 5th MB
Jan 4, 2011 7 14 21 28 36 32
Jan 11, 2011 5 15 25 28 38 16
Jan 18, 2011 2 17 25 28 38 25
Okay, say the above is my table, how do I compare two cells in a row for two numbers? Say I wanted to find out if row A2 contained a 7 and a 28?
"A2" is an address for a single cell, not a row. Its current content, assuming no empty rows above or empty columns left of what's shown, is "Jan 4, 2011". Perhaps you mean Row 2, or the range B2:G2.
Assuming that you want to know 'if' (or 'how many times') two specific numbers occur in the range of cells from column B to column G in a single row, COUNTIF is the function you want.
Place the two target numbers into cell I1 and J1.
Enter the formula below into I2:
=COUNTIF($B2:$G2,I$1)
Fill the formula right into J2, then fill both down to row 4.
You'll get a count of the occurrences of each number.
If you want only a "Yes" (both numbers appear in the range) or "No" (neither of the numbers appear, or one appears but not the other), use this variation (in I2 or J2):
=IF(AND(COUNTIF($B2:$G2,I$1)>0,COUNTIF($B2:$G2,J$1)>0),"Yes","No")
Regards,
Barry

Similar Messages

  • Compare two cells in a ALV

    Hi!!
    I'm doing an ALV, and I need to compare two cells. Only one of them could be inform.
    I used this code:
          CLASS lcl_event_hadler DEFINITION
    CLASS lcl_event_handler DEFINITION.
      PUBLIC SECTION.
        METHODS:
          handle_data_changed
            FOR EVENT data_changed OF cl_gui_alv_grid
                IMPORTING er_data_changed.
    ENDCLASS.                    "lcl_event_handler DEFINITION
          CLASS lcl_event_handler IMPLEMENTATION
    CLASS lcl_event_handler IMPLEMENTATION.
          METHOD handle_data_changed
      METHOD handle_data_changed.
        PERFORM handle_data_changed USING er_data_changed.
      ENDMETHOD.                    "handle_data_changed
    ENDCLASS.                    "lcl_event_handler IMPLEMENTATION
    *&      Form  HANDLE_DATA_CHANGED
          text
         -->P_ER_DATA_CHANGED  text
    FORM handle_data_changed  USING    ir_data_changed
                                       TYPE REF TO
                                       cl_alv_changed_data_protocol.
      DATA: ls_mod_cell TYPE lvc_s_modi,
            lv_value    TYPE lvc_value,
            lv_value1   TYPE lvc_value.
    SORT ir_data_changed->mt_mod_cells." BY row_id.
      LOOP AT ir_data_changed->mt_mod_cells
                               INTO ls_mod_cell
                               WHERE fieldname = 'CELL2'.
        CALL METHOD ir_data_changed->get_cell_value
          EXPORTING
            i_row_id    = ls_mod_cell-row_id
            i_fieldname = 'CELL2'
          IMPORTING
            e_value     = lv_value1.
      ENDLOOP.
      LOOP AT ir_data_changed->mt_mod_cells
                              INTO ls_mod_cell
                              WHERE fieldname = 'CELL1'.
        IF it_prueba-clase IS INITIAL.
          CALL METHOD ir_data_changed->modify_cell
            EXPORTING
              i_row_id    = ls_mod_cell-row_id
              i_fieldname = ls_mod_cell-fieldname
              i_value     = campo_prueba.
        ENDIF.
        CALL METHOD ir_data_changed->get_cell_value
          EXPORTING
            i_row_id    = ls_mod_cell-row_id
            i_fieldname = 'CELL1'
          IMPORTING
            e_value     = lv_value.
        IF lv_value = lv_value1.
          CALL METHOD ir_data_changed->add_protocol_entry
            EXPORTING
              i_msgid     = 'SU'
              i_msgno     = '000'
              i_msgty     = 'E'
              i_msgv1     = 'Only one cell '
              i_fieldname = ls_mod_cell-fieldname
              i_row_id    = ls_mod_cell-row_id.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " HANDLE_DATA_CHANGED
    With this code, i can check only one time the cells. If I clear cell2 press enter, and then I write in cell2 again it code doesn't work.
    How can i do it with other method?
    Thanks in advance

    Head Crab wrote:
    Tuesdays 1st 2nd 3rd 4th 5th MB
    Jan 4, 2011 7 14 21 28 36 32
    Jan 11, 2011 5 15 25 28 38 16
    Jan 18, 2011 2 17 25 28 38 25
    Okay, say the above is my table, how do I compare two cells in a row for two numbers? Say I wanted to find out if row A2 contained a 7 and a 28?
    "A2" is an address for a single cell, not a row. Its current content, assuming no empty rows above or empty columns left of what's shown, is "Jan 4, 2011". Perhaps you mean Row 2, or the range B2:G2.
    Assuming that you want to know 'if' (or 'how many times') two specific numbers occur in the range of cells from column B to column G in a single row, COUNTIF is the function you want.
    Place the two target numbers into cell I1 and J1.
    Enter the formula below into I2:
    =COUNTIF($B2:$G2,I$1)
    Fill the formula right into J2, then fill both down to row 4.
    You'll get a count of the occurrences of each number.
    If you want only a "Yes" (both numbers appear in the range) or "No" (neither of the numbers appear, or one appears but not the other), use this variation (in I2 or J2):
    =IF(AND(COUNTIF($B2:$G2,I$1)>0,COUNTIF($B2:$G2,J$1)>0),"Yes","No")
    Regards,
    Barry

  • In Web Dynpro ABAP, Can we merge two cells of a row in a table ?

    In Web Dynpro ABAP, Can we merge two cells of a row in a table ?

    Hallo Jagannatha,
    the new table feature is available in SAP NetWeaver 7.0 EhP2 (SAP ERP 6.0 EhP5, SAP Business Suite 7i2010) named 'TableMultiEditorCell'. See [SAP Online Help|http://help.sap.com/saphelp_nw70ehp2/helpdata/en/9b/46bb0d339b42cc8d30636ca0c9f5b6/frameset.htm] for more details ...
    "This UI element is a table cell variant that enables several UI elements to be placed in one table cell. This type of cell can be used for "one click actions". ...
    Regards, Bertram

  • Comparing Two tables with 300k records and update one table

    Could you let me know how to compare two tables having 300k records and update one table.below is the scenario.
    Table Tabl_1 has columns A,B and Tabl_2 has columns B,new_column.
    Column B has same data in both the tables.
    I need to update Tabl_2 in new_column with Tabl_1 A column data by comparing B column in both tables.
    I m trying to do using PLSQL Tables.
    Any suggestion?
    Thanks.

    Hi,
    Whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) from all tables involved, so that the people who want to help you can re-create the problem and test their ideas.
    Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
    If you're asking about a DML statement, such as UPDATE, the CREATE TABLE and INSERT statements should re-create the tables as they are before the DML, and the results  will be the contents of the changed table(s) when everything is finished.
    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
    ef2019c7-080c-4475-9cf4-2cf1b1057a41 wrote:
    Could you let me know how to compare two tables having 300k records and update one table.below is the scenario.
    Table Tabl_1 has columns A,B and Tabl_2 has columns B,new_column.
    Column B has same data in both the tables.
    I need to update Tabl_2 in new_column with Tabl_1 A column data by comparing B column in both tables.
    I m trying to do using PLSQL Tables.
    Any suggestion?
    Thanks.
    Why are you trying to use PL/SQL tables?  If tabl_1 and tabl_2 are regular database tables, it will be much simpler and faster just to use them.
    Depending on your requirements, you can do an UPDATE or MERGE, either in SQL or in PL/SQL.

  • How to merge two cells in a row

    hi freinds,
    how to merge two cells in alv grid using oops.
    for eg ,in the first row there is text premraj
             n in the second row there is cheguri
              my requriment is two merge the two cells ie to remove the horizontal line between them
    thanks & regards,
    premraj

    Well, as a new member you should learn to search the forum first before posting questions. Using keywords like "jtable merge cell" will find other postings on this topic. Some with solutions some without, so you will need to read a few and decide on the approach you want to take.

  • Comparing two cells together and highlighting duplicates

    Hello
    I have two lists of emails that are of different length. I'd like to compare these two lists and highlight any duplicates, so that I don't send any email twice to the same person.
    How is this done in Numbers'09?
    Thanks!

    jknuutila wrote:
    Never mind, I got Yvan's formula to work now, thanks both for your help!
    JK,
    Yvan's formula and mine are functionally equivalent, but assume different table names. (Yvan posted before I finished composing my answer and I opted to let mine stand when I noticed.) Of course you must always take care to either make your table names match the equation or make the equation match your table names. And of course, the proper parameter separators must be used.
    We can often avoid problems with parameter separators in our examples, and we can be careful to use simple, plain English, if we suspect that you are in a location where the semicolon replaces the comma as a separator, and where English may not be the first language. This requires that you edit your Profile Data to show your country/location. The more we know about you, the easier this becomes.
    Best regards,
    Jerry

  • Compare two text files in Powershell and if a name is found in both files output content from file 2 to a 3rd text file

    Is it possible using PowerShell to compare the contents of two text files line by line and if a line is found output that line to a third text file?
    Lets say hypothetically someone asks us to search a text file named names1.txt and when a name is found in names1.txt we then pair that with the same name in the second text file called names2.txt
    lets say the names shown below are in names1.txt
    Bob
    Mike
    George
    Lets say the names and contents shown below are in names2.txt
    Lisa
    Jordan
    Mike 1112222
    Bob 8675309
    Don
    Joe
    Lets say we want names3.txt to contain the data shown below
    Mike 1112222
    Bob 8675309
    In vbscript I used search and replace commands to get part of the way there like this
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.OpenTextFile("testing.txt", ForReading)
    strText = objFile.ReadAll
    objFile.Close
    strNewText = Replace(strText, "Mike ", "Mike 1112222")
    Set objFile = objFSO.OpenTextFile("testing.txt", ForWriting)
    objFile.WriteLine strNewText
    objFile.Close
    That script works great when you know the name you are looking for and the correct values. Lets say someone gives you a list of 1000 employees and says import these names into a list in the correct format and one sheet has the correct names only and
    the other sheet has lots of extra names say 200000 and you only need the 1000 you are looking for in the format from names2.txt.

    Sure,
    Here's a simple one:
    $names1 = "C:\names1.txt"
    $names2 = "C:\names2.txt"
    $names3 = "C:\names3.txt"
    Get-Content $names1 | ForEach-Object {
    $names1_Line = $_
    Get-Content $names2 | Where-Object {$_.Contains($names1_Line)} | Out-File -FilePath $names3 -Append
    This basically just reads $names1 file, line by line, and then read $names2 file line by line as well.
    If the line being evaluated from $names2 file contains the line being evaluated from $names1 file, then the line from $names2 file gets output to $names3 file, appending to what's already there.
    This might need a few more tinkering to get it to perform faster etc depending on your requirements. For example:
    - If either $names1 or $names2 contain a lot of entries (in the region of hundreds) then it will be faster to load the whole content of $names2 into memory rather than opening the file, reading line by line, closing and then doing the same for every single
    line in $names1 (which is how it is currently works)
    - Make sure that your comparison is behaving as expected. The .Contains method always does a case sensitive comparison, this might not be what you are after.
    - You might want to put a condition to ignore blank lines or lines with spaces, else they'll also be brought over to $names3
    Hopefully this will get you started though and ask if you have further questions.
    Fausto

  • Comparing two PDF documents | Acrobat Tips and Tricks | Adobe TV

    This video will get you started with using the improved Compare Documents command in Acrobat 9 to identify what has changed between two versions of a PDF file.
    http://adobe.ly/xqvrc7

    Hi there. Thanks for the video. But is there a feature to move among the found differences? Or to show ONLY the differences? In a large document, it's not enough to just "look for" the color-coded differences.
    I have not found any such features on viewing a compared doc. I've also looked in the help and now am looking to see if other resources discussing PDF compare might show it. Thanks for any thoughts.

  • BUG? BRIDGE statement to compare two tables

    Hello,
    I tried to compare two tables in different dbs and remembered a post about Cross Connectin Queries
    http://barrymcgillin.blogspot.com/2010/11/cross-connection-queries.html
    BRIDGE temparb AS "EB05 01"
    (SELECT * FROM arb)
    (SELECT * FROM temparb
    MINUS
    SELECT * FROM arb
    UNION ALL
    (SELECT * FROM arb
    MINUS
    SELECT * FROM temparb
    );I would expect to get the differences between the table arb in my current schema and the table arb alias temparb in the other db. Yet it seems, that in this case only the table in my current schema is read.
    I materialize the BRIDGE table with
    BRIDGE temparb AS "EB05 01"
    (SELECT * FROM arb)and select the value I know to be only in the remote schema
    SELECT id FROM temparb WHERE id = 2562;
    SELECT id FROM arb WHERE id = 2562;Both times I get no result. I even tried to use aliases on the table, same result. Tested in 3.0 and 3.1 EA3.
    Has anyone tried this before?
    Regards
    Marcus

    Hi Marcus,
    Have you tried it without the double quotes around the connection name?
    I have a connection called
    system_local
    which I run the following command in
    drop table testbridge_remote;
    drop table testdbrige;
    create table testbridge(col1 int);
    insert into testbridge values (1);
    insert into testbridge values (2);
    insert into testbridge values (3);
    commit;
    I have a connection called
    Connection Name With Space
    which I run the following in
    drop table testdbrige;
    create table testbridge(col1 int);
    insert into testbridge values (4);
    insert into testbridge values (5);
    insert into testbridge values (3);
    commit;
    Then in the system_local connection/worksheet I can run the following statement
    BRIDGE testbridge_remote as Connection Name With Space(select * from testbridge)
    +(SELECT * FROM testbridge_remote+
    MINUS
    SELECT * FROM testbridge
    +)+
    UNION ALL
    +(SELECT * FROM testbridge+
    MINUS
    SELECT * FROM testbridge_remote
    +);+
    It works ok.
    Returning rows in the remote table not in the local table , and rows in the local table not in the remote table .
    Regards,
    Dermot
    SQL Developer Team.

  • Merge cells between 2 rows in a smart form(template)

    Hi ,
    I need to merge two cells between 2 rows of a template.
    Like the first cell is a big one 10cm height and has two adjacent 5cm cells beside it.
    Can anyone tell me if this is possible.And if Yes ,How?
    Merging cells between columns work,but i am not able to do it betweeen two rows.
    I had some Options that i treid and ruled out are
    Since it is flowing data i cant use multiple windows and so the template needs to be in my mainwindow.
    I cant use multiple main windows also .
    This merging doesnt work in table also.
    Regrads,
    Sai.

    Well I dont know if i am not clear in my question.
    Let me articulate.
    It not the conditional display of rows taht i want to acheive.
    Its  merging cells between two rows.
    Like say first a cell of height 10 cm shoudl filled with text (say 'AB')spanning full 10 cm.
    And then adjacent to this 10cm cell , there shoud be two cells of say 5cm one below each other
    with say 'A' on the top cell and 'B' on the bottom cell.
    So you have one big 'AB' (10cm cell) and then beside this you have ' A' and 'B' one below each other.
    Like shown below the Bold 'AB' spans 10 cm from top to bottom ,beside this AB is A in the top 5cm cell and
    B in the bottom 5 cm cell.
    ABA
            B
    Regards,
    Sai.

  • Compare two fields of one table in selection.

    Dear Experts,
    I want to compare two fields of a table and make selection according to this.
    Ex: simply i want to select the rows from table mard where mard-labst>mard-insme. Could you write me the code to make this selection.

    Yes, Thomas,
    Its working:
    Sample code:
    data: begin of itab occurs 0,
          matnr type matnr,
          ernam type ernam,
          end of itab.
    select matnr ernam
           into table itab
           from mara where brgew > mara~ntgew.
    loop at itab.
      write: itab-matnr.
    endloop.
    Or,
    Try with inner join once.
    Its working: Sample code.
    data: begin of itab occurs 0,
          matnr type matnr,
          ernam type ernam,
          end of itab.
    select p~matnr q~ernam
           into table itab
           from mara as p
           inner join mara as q
           on p~brgew > q~ntgew.
    loop at itab.
      write: itab-matnr.
    endloop.
    Thanks,
    Naveen.I

  • Compare two similar objects

    Do you know about any possible Java bugs with JDK update?
    In my case, my code stopped working.
    Here is what I have. There are two similar objects, but Object 1 has key, and Object 2 (same as Object 1) has no key. I need to compare both, and if they are equal, I need Object 1 to assign key to Object 2.
    It worked before. How I can get around.
    Please help me if you can.
    Respectfully,
    Alex

    Let me change the question:
    "Can we compare two objects one with key and another one without key? How?

  • Compare two records within a view

    Hi,
    I wonder if it is possible to compare two or more records within a view, and how to do it.
    Thanks in advance.

    M. Comi wrote:
    I wanted to compare two records of the view and see if they are the same or not...
    My data are as follows:
    Soglia Ingresso_CL_PF     10     10
    Downgrade MDP 3     2102     2101
    I want to check if the "downgrade" records have the same values for the second and the third column, and in this case replace the values on the second record.
    But I did it with a select on the same fields of the original tables, plus two fields obtained with lag function...
    I don't know if it is clear or not, the important is that I got what I wanted.Sorry, it's not clear.
    Are you still having a problem? If so:
    (1) Please describe the problem.
    (2) What results do you want to see from the sample data you posted?
    (3) Is the second column of
    Downgrade MDP 3 2102 2101'Downgrade', 'MDP', 3, 2102, 2101, some combination, or NULL? When posting data, the most helpful thing is to post INSERT (or CREATE TABLE AS ...) statements. The second-best thing is to post formatted data. Type {code} before and after sections where spacing is important, and post column headers.

  • Comparing two Oracle sources

    Hi,
    I need to compare two diffrent Oracle datadictionary sources and need its report.
    Is there any tool available for this purpose. This is for one of our datawarehousing projects. So, data dictionary migt be bigger.
    Please help
    Sony

    How can I ceck two schamas uisng TOAD, Can you please explain this.
    which option i need to take.

  • HELP : Comparing two programs(DEV & PROD)

    Hi,
    I want to compare two programs one from dev and other from prod and check whether it is identical or not....the number of programs are in thousands.....so is there any FM or program so that i can automate it.....plz help!!

    Hi Ajay,
    i have solution for ur problem.
    1. Go to program -> utilities-. version-> versiopn management.
    2.u arrive at new screen.
    3.type /h to make debuggin on.
    4. now click any push button for comparison..
    5.in field textbox of debbuger , type 'SY-UCOMM' to get the ok_code for that push-button.
    6.once u get the ok_code , u can use
    'CALL TRANSACTION 'SE38' USING BDC_DATA '.
    7.To get more details on such kind of abaP statement , select that statement and press F1 , you wud get reference example out at bottm..
    8. refere to that along with also check out for screen no , prohram name , ok_code , which are needed for that transaction.
    regards
    Note: reward points if useful

Maybe you are looking for

  • Dual Boot Selection with two SSD Installed

    I have two SAMSUNG SSD's installed in the W540. SSD #1  -- Microsoft Windows 7 Professional SSD #2 -- Microsoft Windows 7 Ultimate The SSD's had a complete install of each Microsoft Windows operating system without using the dual boot manager. I sele

  • Top level navigation is lost

    Hi All, FYI We are building a sandbox system and doing branding for it. I had downloaded the par file zipped it and extracted its content made a lil change in a java script same as our existing portal, and uplaoded the file through administration con

  • Can i use Sub Query Factoring Here ?

    Hi; SQL>SELECT * FROM V$VERSION; BANNER Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production PL/SQL Release 11.1.0.7.0 - Production CORE    11.1.0.7.0      Production TNS for Linux: Version 11.1.0.7.0 - Production NLSRTL Versi

  • Validate 'x' amount of select field's using cfloop

    I have a cfloop to output "x" many select's in a form that a user specify's to display. On form submission I want to validate that each of their "x" many form fields has been chosen.     (if user wanted to display 5, they shouldn't just do 3 of them)

  • Blu-ray Error code 25

    I am trying to burn a Blu-ray DVD the disc Info says 6.56 is used and 18.44GB is free. I am using a 25GB sony Blu-ray DVD. The error code says there is "not enough free storage", Code:"25", Note: "not enough hard disc space". Is this a problem with t