I have a dataset (single column) with repeating numbers. One number can repeat consecutively for 10 rows then switch to another number that repeats for 26 rows and may even go back to a previous number and repeat for another 30 rows. I used the cell code =UNIQUE(FILTER(L:L, L:L<>"")) but this does not capture non-unique repetition. I want to get the sequence of numbers that captures the number every time the repetition changes.
Dataset
10
10
10
10
4
4
4
4
9
9
9
4
4
4
Desired
10
4
9
4
use:
=LET(rng,A1:A14,rang2,A2:A15,FILTER(rang2,rang2<>rng))
or, if you do not mind the volatile function OFFSET:
=LET(rang2,A2:A15,rng,OFFSET(rang2,-1,0),FILTER(rang2,rang2<>rng))
Related
I want to compare two different tables in Excel if they have exactly the same rows [number of rows and their fields] but the rows may not be necessarilly in the same order,
say:
col1---col2---col3---col4 col1---col2---col3---col4
1 10 15 2 3 30 13 6
2 20 14 4 4 40 12 8
3 30 13 6 1 10 15 2
4 40 12 8 2 20 14 4
TABLE_1 TABLE_2
I call this equivalent tables.
Is there an excel function, or combination of functions, that can give me TRUE if both tables are equivalent, and FALSE if not?
You can put two helper columns in the tables with the following formula:
=SUMPRODUCT(--(A2:D2=INDEX(G:J,MATCH(A2,G:G,0),0)))=COLUMNS(A:D)
and
=SUMPRODUCT(--(G2:J2=INDEX(A:D,MATCH(G2,A:A,0),0)))=COLUMNS(G:J)
Then count those helper columns for FALSE:
=AND(COUNTIF(E:E,FALSE)=0,COUNTIF(K:K,FALSE)=0)
This will return FALSE if any of the rows return false.
And when one cell does not match:
You may go around it with the following shortcut, which is not 100% sure but very high possibility of being sure. but it is extremely easy to apply.
first, format your tables as real Tables. Home enu>Format as Table
then, write this formula: =SUM(Table1)=SUM(Table2)
it would be very little probability for them to be equal if they are not the same.
I'm sorry if this has been answered. I've been searching around for awhile now.
I have a times series dataset that I need to perform calculations on based on the previous x time (last hour,day, etc).
My issues is that I don't know how to run these calculations since the time deltas are not standardized.
Example:
Column A - Time (in seconds lets say)
Column B - Value
Time Value Result(5)
01 3 0
02 5 3
04 4 8
07 8 9
09 6 12
13 4 6
14 4 10
15 1 8
22 9 0
33 7 0
How could I return the Result(5) column by summing the last 5 seconds from that one instance (row) (not including it)?
Thank you.
EDIT:
To clear up what I'm trying to do:
1) Find the previous 5 secs of data using column A and return that range of rows
2) Using that range of rows for the 5 previous secs, sum column B
3) Output in Column C (formula)
The following formula should do what you need (paste into C2 and drag down):
=SUMIFS($B$2:$B$11,$A$2:$A$11,">="&A2-5,$A$2:$A$11,"<"&A2)
Where YourTime is the time in the row you wish to look back and sum over.
I've tested and it works for the data you provided - expand the ranges as appropriate.
I have rows of data that contains numbers from 1 to 15, however these numbers can be in any sequence. For example here:
3 2 1 12 13 5 6 7 9 15 10 8 4 15 11
I know from a visual count these numbers above are all correct; as there are no duplicates, and all the numbers have values from 1 to 15. An example of a row of data I found to be wrong:
3 2 1 12 12 5 6 7 9 15 10 8 4 15
You can see this line has duplicated numbers i.e. 12, and number 11 is missing, so this row only has 14 elements in all.
However, I have many rows of data and it is impossible to visually check each row. I need to ensure in each row: there are 15 elements; there are no duplicates, and that the row contains values from 1 to 15 and find which rows are faulty to check these against the original paper data.
Is there a command or function that I can use in Excel to make this process easier?
You could find a set of conditions, each of which is true for rows that contain exactly those 15 numbers in any order and then test several of them. For example, if the row is in A5:O5:
=AND(COUNT(A5:O5)=15,SUM(A5:O5)=120,MIN(A5:O5)=1,MAX(A5:O5)=15,
AVERAGE(A5:O5)=8,ROUND(STDEV(A5:O5),3)=4.472)
This will show TRUE for a row that contains the integers 1 to 15 in any order, and is very unlikely (it could very well be impossible - I haven't checked) to show TRUE for a row that contains any different set of integers.
I'm pretty sure that the only way 15 positive integers less than 16 can add up to 120 other than by all being different is with duplication, so :
Check there are 15 numbers
Check their total is 120
Check the maximum is 15
Check not negative (nor zero):
=IF(OR(COUNT(A5:O5)<>15,SUM(A5:O5)<>120,MAX(A5:O5)>15,MIN(A5:O5)<1),"Error","Plausible")
then check for duplication with Conditional Formatting using a rule such as :
=COUNTIF($A5:$O5,A5)>1
and a distinctive format. Filter to select "Plausible" and then anything with a distnctive format is non compliant.
I have a very long column( 50000 rows) and I want select a range (sample) of cells (number of rows) in order to apply certain calculations. You don't have to worry about the calculation formula. Here I just need help on how to do the sampling. The range(sample) should be changing based on window size. The window size is a number I can choose .i.e such in the example below I chose the window size to be 4. In other words, I need to have samples, and these samples are based on selected number of rows of the long column. The size(number of rows) for all of the samples will be equal to the window size. However, each sample is shifted by one from the main column. Now, the samples should be in seperate columns , and thats why I need to copy the selection in each sample in its required column.For illustration purpose, assume the below example:
let assume the window size( number of rows)=4
test
1
2
3
4
5
6
7
8
9
10
The expected output should be :
main col sample1 sample2 sample3 sample4 sample5 sample6
1 1 2 3 4 5 6
2 2 3 4 5 6 7
3 3 4 5 6 7 8
4 4 5 6 7 8 9
5
6
7
8
9
10
each sample of size 4 rows , however, each new sample shifs by 1 from the main column. Note we get 6 samples to cover the whole number of rows in the main column. What basically should be done: sample1 will be from row1-to-row4 from the main col. Now, sample2 will be 4 values, however, from row2-to-row5, from the main column. sample3 will be 4 values, from row3-to-row6, and so on until we cover the whole range of the main column. So there are two main process, selection and copy of selection.
I have tried to use the offset and other logical function ... but it didn't work. I don't want to use Macros or VBA... Is there are any built in functions to solve the problem.?
This is basically a variation of a range transpose. Use the formula:
=INDEX($A:$A,COLUMN()+ROW()-2,1)
Then just copy to whatever window size you want. It will automatically move down the main column by one row for every column over it is. The result looks like this (you are responsible for copying the formula to the right size):
Bonus, you can automate the column header "Sample N" with:
="Sample " & COLUMN()-1
Does anyone know how to find or make a WPF container control that will display a two dimensional array of fixed-size sub-controls (the number of sub-controls varying at run time) such that the first row is filled, then the second row, and so on, until there are no more sub-controls or all the rows are filled. If the user makes the container wider then the number of columns should increase, so:
1 2 3
4 5 6
7 8 9
would become
1 2 3 4
5 6 7 8
9