How would I find the most common value every nth row in a column

SCENARIO 1
I have a column with a series of numbers in c1:c1000 as follows:
2
2
3
1
1
4
2
3
1
2...
and I would like to find the most common value for every nth (in this case, second) row.
SCENARIO 2
Originally, I created a separate column in J and used this to find a value of 0 or 1 via a filter to label the rows odd or even. I was then going to create two separate columns, one for even rows of data and another for odd rows of data to separate them and perform functions on each column. But I do not know how to copy just the filtered data to one of the new columns to apply the MODE function (or any other for that matter).
Perhaps my question should be: after applying a filter, how do i copy just the visible filtered data of every nth row to a new column in my spreadsheet while retaining the original column with all rows of data? 
BACK TO SCENARIO 1
If I do not need to go through this effort, I would just apply the MODE function (or AVERAGE or SUM) to every nth row in the original data column.

Since Index and Offset were already taken, I used INDIRECT(ADDRESS()) in my example.
Here's how I approached it:
Expressions are as follows...
Data Subset, Column A, Row 2: =IF(StartingRow :: A, 1, NSelector :: $A)
Subsequent rows in Column A: =IF(ROW()<COUNT(Input :: $B)/NSelector :: A:$A+2, A2+NSelector :: $A, "")
Data Subset, Column B, Rows 3
throuth the last: =IFERROR(INDIRECT(ADDRESS(A+1, 2, ,,"Input")), "")
Stats, Column A, Row 2: =IFERROR(MODE(Data Subset :: B), "No Mode")
Stats, Column B, Row 2: =COUNTIF(Data Subset :: B, A)
Lots of ways to skin this cat.
Jerry

Similar Messages

  • Finding the most common value in an array of enums

    Hello,
    I'm looking for an elegant way of finding the most common value in an array of enums
    My enum being:
    0 - Close
    1 - Open
    2 - Undefined
    For instance, if my array contains:
    Close, Close, Open, Close, Close, Open.
    The most common value would be "Close"
    I have created a very customized VI that allows me to obtain the desired result, but I'm really not proud of doing it this way, simply because I would have to modify it if I were to add a new value to my enum...
    If someone can share some ideas to enlighten me, I would REALLY appreciate it.
    Thanks in advance!
    Jorge
    Solved!
    Go to Solution.

    Here is the variant using the search method. This method will run N-1 times where N is the number of ENUM elements. Yes, it is a bit more complex than the brute force method but it would execute fairly quickly. The sort would probably be the time consuming task.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot
    Attachments:
    ENUM Counter.vi ‏14 KB
    Enum.ctl ‏4 KB

  • How can we find the most usage and lowest usage of table in Sql Server by T-SQL

    how can we find the most usage and lowest usage of table in Sql Server by T-SQL
    The table has time stamp column
    StartedOn datetime
    EndedOn datetime

    The Below query has been used , but the textdata column doesnot include the name of the table ServiceLog.
    SELECT
    FROM
    databasename,
    duration
    fn_trace_gettable('F:\Program
    Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Log\log_148.trc',
    default)
    WHERE
    DATABASENAME='ZTCFUTURE'
    AND TEXTDATA
    IS
    NOT
    NULL
    --AND TEXTDATA LIKE 'SERVICE%'
    order
    by cpu
    desc; 

  • How can if find the most repeated character and number ???

    Hi,
    I have a question. For instance, if we have a text file which contains:
    aaabbbhhhhhhtttttsjs12366
    How can i find the most repeated character and number. I have to add this code to the following program:
    I will aprreciate if you can help.
    Regards,
    Serkan
    import java.io.*;
    public class LineLen {
         public static void main(String args[]) throws Throwable {
              final String filename = "deneme1.txt";
              BufferedReader infile = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));
              String line = infile.readLine();
              int linenum = 0;
              while (line != null) {
                   int len = line.length();
                   linenum++;
                   System.out.print(linenum + "\t");
                   for (int i = 0; i<len; i++)
                   System.out.print("*");
                   System.out.println("");
                   line = infile.readLine();
    }

    For a small alphabet like English, array migt be used:
    //in a for loop
    ++array[s.charAt(i)];For a big alphabet like chinese, HashMap might be barely used:
    map.put(s.charAt(i), increment(map.get(s.charAt(i))));
    // increment is a user defined method, possibly for an Integer object,
    // that returns a new Integer object

  • How would I find the firefox specific styling information?

    I recently ran across the following (archived) help article: https://support.mozilla.org/en-US/questions/814083
    How would I find the information posted inside here? Is there a wiki page or something I could consult?
    Thanks

    Have a look at
    * http://kb.mozillazine.org/Chrome_folder
    * https://developer.mozilla.org/en-US/docs/Chrome_Registration
    It is of course easier to use addons, but it depends on your intentions
    * https://support.mozilla.org/products/firefox/customize
    *https://addons.mozilla.org/firefox/addon/classicthemerestorer/
    * https://addons.mozilla.org/en-US/firefox/addon/stylish/
    * Or for web content https://addons.mozilla.org//firefox/addon/greasemonkey/

  • How would you find the pitch period of a sound signal?

    Hi
    I have a few questions and i would like if somebody could help me even with the smallest comment on this.
    How would someone be successfully estimate the pitch period (fundamental frequency) of a 5 second sound file?How would you successfully distinguish the voiced from the unvoiced parts and how would you make sure you dont mix voiced/unvoiced sections? Finally how can you find the exact points where the pitch is at its peak throughout the signal?
    Any help/comment/suggesion would be much appreciated

    Hello Madgreek,
    After some thought I think I may have come up with an algorithm for what we have discussed. Basically, you are interested in knowing the time intervals over which you can observe any given frequency in your signal. As you had suggested, you can examine small windows of your signal and perform FFTs on each of the small windows to determine what frequency content is contained in that window. By examining all of the windows, you will see when particular frequencies are prevalent in the original signal. You'd want to use the smallest allowable window to give you the most resolution, but one that is large enough to cover an entire period of the lowest frequency (so that you don't miss this frequency).
    I have attached an example program that performs this operation. The example performs this analysis on an array that represents audio data. I am basically performing multiple FFTs (for each window) and stacking these FFTs in time to form a 3D plot. By examining the 3D plot, I can then see when in time my frequencies of interest are at their peaks. Rather than graphing these plots, you may work out a different algorithm for programmatically determining and logging these peaks and times. I hope this is what you were looking for!
    Attachments:
    Time Variable FFT.vi ‏250 KB

  • How to find the most matched values in the set of map?

    Hi friends!
    I have two vectors
    vector<int> V1; vector<int> V2;
    and a map<int, set<int>> M1;
    I want to select common values from both V1 and V2 and check those values with the set in the map M1.
    For example:
    V1 contains;
    2  4  6  8  9
    V2 contains;
    4  5  6  9  10 
    M1 contains;
    1=>1  2  5  9
    2=>4
    3=>5   10
    4=>2  4  8
    5=>4   9
    6=>4   6
    7=>9  12
    When we select the common values of V1 and V2 it is 4, 6, 9.
    And we search for all 4, 6, 9 from the values of M1 which give more appropriate.
    But, no all values in the set of map.
    Then, we delete any value from 4, 6, 9, then remaining values would match any values from the map.
    From the example, if we delete 6, then remaining 4, 9 will match with 5=>4  9, or if we delete 9, then 6=>4   6. Any one of the keys can be selected.
    I know how to select the common values from V1 and V2, but I do not know how to match with the values and select the appropriate key from M1.
    Could anyone help me to solve this?

    This is not the question you asked, except perhaps in the subject. The subject is not the right place to put key features of the question. It is also important to use the body to ask just the question you want
    answered. For example your real question has nothing to do with V1 and V2, just the common vector V (e.g. 4 6 9).
    One way to solve your problem would be to create a new map
    map<int, set<int>> M2;
    with the same keys as M1. Each set of M2 should contain the elements of V that are
    not in the corresponding set of M1.
    Then pick the key of M2 that has the smallest set. If that set is empty, then the whole of V can be used. Otherwise the smallest set tells which elements of V have to be removed, and which is the desired key of M1.
    In your example, key 5 of M2 will contain just 6, so you should remove 6 from V and select key 5.
    Yes fine. I tried the following code and it creates the map M2 (NewMyMap in my code). But how to find the smallest set starting from size 1?
    #include <vector>
    #include <algorithm>
    #include <iostream>
    #include <map>
    #include <set>
    using namespace std;
    typedef vector<int> IntVec;
    typedef set<int> IntSet;
    typedef map<int, IntSet> SetMap;
    bool IsValueNotInSet(int value, IntSet& S);
    SetMap CreatNewSetMap();
    IntVec IVec; //This vector is for selecting certain keys from mySet map.
    IntVec myVec;
    SetMap mySet;
    SetMap NewMyMap;
    int main()
    IVec.push_back(3); IVec.push_back(4); IVec.push_back(5); IVec.push_back(6);
    myVec.push_back(4); myVec.push_back(6); myVec.push_back(9);
    IntSet tempS;
    tempS.insert(1); tempS.insert(2); tempS.insert(5); tempS.insert(9);
    mySet.insert(make_pair(1,tempS));
    tempS.clear();
    tempS.insert(4);
    mySet.insert(make_pair(2,tempS));
    tempS.clear();
    tempS.insert(5); tempS.insert(10);
    mySet.insert(make_pair(3,tempS));
    tempS.clear();
    tempS.insert(2); tempS.insert(4); tempS.insert(8);
    mySet.insert(make_pair(4,tempS));
    tempS.clear();
    tempS.insert(4); tempS.insert(9);
    mySet.insert(make_pair(5,tempS));
    tempS.clear();
    tempS.insert(4); tempS.insert(6);
    mySet.insert(make_pair(6,tempS));
    tempS.clear();
    tempS.insert(9); tempS.insert(12);
    mySet.insert(make_pair(7,tempS));
    cout<<"MYVEC\n";
    cout<<"-------------\n";
    for(IntVec::iterator itv = myVec.begin(); itv != myVec.end(); ++itv)
    cout<<(*itv)<<" ";
    cout<<"\n\n";
    cout<<"\nMYSET\n";
    cout<<"-------------";
    for(map<int,set<int>>::iterator its = mySet.begin(); its != mySet.end(); ++its)
    cout << endl << its->first <<" =>";
    for(IntSet::iterator sit=its->second.begin();sit!=its->second.end();++sit)
    cout<<" "<<(*sit);
    cout<<"\n\n";
    NewMyMap= CreatNewSetMap();
    cout<<"\nNEWMYSET\n";
    cout<<"-------------";
    for(map<int,set<int>>::iterator its1 = NewMyMap.begin(); its1 != NewMyMap.end(); ++its1)
    cout << endl << its1->first <<" =>";
    for(IntSet::iterator sit=its1->second.begin();sit!=its1->second.end();++sit)
    cout<<" "<<(*sit);
    cout<<"\n\n";
    return 0;
    bool IsValueNotInSet(int value, IntSet& S)
    IntSet::iterator it=find (S.begin(), S.end(), value);
    if (it!=S.end())
    return false;
    return true;
    SetMap CreatNewSetMap()
    IntSet TSet;
    for(IntVec::iterator it = IVec.begin(); it != IVec.end(); ++it)
    SetMap::iterator its = mySet.find(*it);
    if (its != mySet.end())
    TSet.clear();
    int key = its->first;
    IntSet& itset = its->second;
    for(IntVec::iterator itv = myVec.begin(); itv != myVec.end(); ++itv)
    if(IsValueNotInSet((*itv), itset))
    TSet.insert(*itv);
    NewMyMap.insert(make_pair(key,TSet));
    return NewMyMap;

  • How to find make most common value?

    Hello,
    I have data like this
    Customer Invoice number payment term
    ABC 10001 K20
    ABC 10002 K40
    ABC 10003 K20
    ZYX 10004 K30
    ZYX 10005 K20
    ZYX 10006 K30
    Now I want to make report which will show most common payment term. I tried with count etc. with no result.
    I want report like this
    ABC K20
    ZYX K30
    Regards,
    Luko

    Hi,
    You can set the GROUP BY clause in the Advanced Tab
    http://gerardnico.com/wiki/dat/obiee/group_by
    Please refer the below links,
    Group By in OBIEE
    Or,
    count(customet by customer,payment term) (or) you can apply those columns in Advanced tab then apply below filter in your report.
    Apply fiter >grather than 1
    Hope this help's
    Thanks,
    Satya

  • How do I find the most recent version of ipad apps?

    I have duplicate app icons on my ipad2. How do I find out which is the most recent so I can delete the older version?

    Unless you have a Free and paid version of an App that happen to be two distinct Apps in the store, there's really no way to have 2 versions of the same App.
    When most apps update they replace the existing one automatically.
    Though I do know of a few that have released completely different apps in an update instead of updating the existing one. When that happens usually the old version no longer works, and prompts you to update to the newer one. So all you can do is remove it.

  • How would I find the Photoshop Camera Raw plug-in

    Can someone please tell me how or where to find the "Camera Raw Plug-In?

    Are you talking about finding the ACR plug-in in your computer, or a n ACR manual update on the Adobe site?
    Details are needed.
    BOILERPLATE TEXT:
    Note that because this is boilerplate text, not all points may apply to any given, specific poster.
    If you give complete and detailed information about your setup and the issue at hand,
    such as your platform (Mac or Win),
    exact versions of your OS, of Photoshop (not just "CS6", but something like CS6v.13.0.6) and of Bridge,
    your settings in Photoshop > Preference > Performance
    the type of file you were working on,
    machine specs, such as total installed RAM, scratch file HDs, total available HD space, video card specs, including total VRAM installed,
    what troubleshooting steps you have taken so far,
    what error message(s) you receive,
    if having issues opening raw files also the exact camera make and model that generated them,
    if you're having printing issues, indicate the exact make and model of your printer, paper size, image dimensions in pixels (so many pixels wide by so many pixels high). if going through a RIP, specify that too.
    etc.,
    someone may be able to help you (not necessarily this poster).
    a screen shot of your settings or of the image could be very helpful too.
    Please read this FAQ for advice on how to ask your questions correctly for quicker and better answers:
    http://forums.adobe.com/thread/419981?tstart=0
    Thanks!

  • How would I find the first date a shipment occurred for a specific material

    We need to determine when an item is new and set the u201Cnew item indicatoru201D to True.  Once a material is considered new, the u201Cnew item indicatoru201D should remain true for a period of three years.  Each week, a process needs to run that looks at the material master data (First Arrival Date) and compares that with the current date to check if three years has passed.  If three years has passed, then the u201Cnew item indicatoru201D should be set to False. Initially, all items need to go through this process to set the new item indicator.

    Hi,
    You could setup a DSO keyed by material in which you have a date key figure that is set to MIN aggregation in the transformation. If you load that DSO from your shipments, it will automatically keep the date of the first shipment.
    You could then run a periodic load that could be picking up all the materials whose date in the DSO is older than 3 years and which are still marked as NEW_ITEM. In that load you then update the NEW_ITEM status.
    Cheers
    Henry

  • How do I find the closest value to a constant in an array

    I have an array of floating numbers and I want to find a value in that array that is closest to a floating constant.     For example if I have the array 5.9, 2.8, 3.7, 5.8, 6.9, and if I have the constant 5.4, how would I find the closest value to 5.4 in the array, which in this case would be 5.8. The only approach I can think of is to subtract each value in the array from 5.8 and find the minimum value of an array which would be created from the differences. Is there a better approach?
    Thank you.

    Just be sure to take the absolute value of the difference and your proposed method is fine.

  • Find the 20 max values

    Say i have an array of 40 doubles. How can i find the 20 maximum values from my array?

    Do you know how to sort?
    Can you use the Java APIs?ha ha..
    yeah.. sort the array and pick the 20.
    Or if you write something like a bubble sort, let the outer loop executing half times as the usual..

  • How to find the offending DML for "enq: TX - row lock contention"

    Hello All,
    1) How can I find the offending DML for "enq: TX - row lock contention". I have tracked down the Blocking and Waiting Sessions as well as the Database Object too. But i am not able to find the DML (with values of bind variables) or the row for which both these sessions are fighting for?
    Current Wait Event:  enq: TX - row lock contention
    Current Wait Class:  Application
    Wait Duration:  5:15 (mm:ss)
    P1:  name|mode 1415053318
    P2:  usn<<16 | slot 12058642
    P3:  sequence 39951
    Object:  USERNAME.MEMBER 2) Also does *"enq: TX - row lock contention"* means Both the sessions are fighting for the same Row only or it can be different rows but same database block? If they are fighting for different rows, then can we try increasing the initrans of tables/indexes to prevent this wait.
    Please advice.
    Regards,
    Tommy

    Thanks Randolf, Mark and Aman for your valuable inputs. We are using 10.2 and the lock mode held and requested is 6. And the Wait Event is "enq: TX - row lock contention".
    Based on the above facts and based on Randolf's Blog, can we ignore the following cases?:
    - Same unique key written by different sessions: Because mode held and requested in ym case is 6 whereas in Randolf example it is 6 and 4 respectively
    - Unindexed foreign keys and modifications to parent table primary keys: Because Wait Event in my case is "enq: TX - row lock contention"
    - Insufficient block space and ITL slot shortage: Because Wait Event in my case is "enq: TX - row lock contention" and not enq: TX - allocate ITL entry
    - Segments with low MAXTRANS settings Only pre-10g: But Mine is 10g
    And the possible scenarios left out scenarios are:
    - Bitmap indexes
    - Same Row modified by different sessions
    I will now try to find out the sql/dml that is causing the problem. Thank you all for your help once again.
    SESS                        ID1        ID2      LMODE    REQUEST TY
    Holder: 138              393224       1330          6          0 TX
    Waiter: 140              393224       1330          0          6 TX

  • HT4623 I have ios 5.1 and according to my ipad there are no ios updates but yet there are apps I would like to use that require 6.0 or later.  how do i get the most recent ios 7.0.3?

    how and where do I the the latest IOS for IPAD!!!

    Fredronalderman wrote:
    there are apps I would like to use that require 6.0 or later.  how do i get the most recent ios 7.0.3?
    Finding iOS Apps Compatible with Older Devices
    App Store: Downloading Older Versions of Apps

Maybe you are looking for