Is there a control to arrange a variable number of sub-controls? - wpf-controls

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

Related

Alternative to Unique(Filter)

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))

Use of Vector Cross in Ms Excel - 3D arrays and Redim

I'm facing an issue with the use of Redim in VBA of MS Excel in a 3D array. How can I append a new array with different dimension than the first one to the first array and then another one and then ...; and then be able to read a specific group of data from this newly created matrix (array) with different number of columns in each row, for example, the 2nd group of data. Here is an example to clarify the matter.
Arr1 is in 3x3
Arr2 is in 5x5
Arr3 is in 7x7
Arr4 is in 9x9
Arr5 is in 11x11 dimensions.
Now if I append them together the resulting matrix should be in this format - for example:
1 2 3
4 5 6
7 8 9
1 2 3 4 5
6 7 8 9 1
2 3 4 5 6
7 8 9 1 2
3 4 5 6 7
...
...
1 2 3 ... 11
1 2 3 ... 11
(another 8 rows)
1 2 3 ... 11
(total of 11 rows)
Next I want to be able to read a group of data (sub-matrix) from the resulting matrix, for example the 2nd group of data, which is in 5x5.
If I use Redim in between each loop, while appending those new group of arrays and so to adjust the dimensions of the first matrix and continuing to do so, the last dimension will be in 11x11, which does not give me the needed dimension; in this case 5x5.
I was wondering, if there is any recommendation you could kindly provide. Thank you.

Excel: select a changing range from a column and copy it

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

will ABS formula columns sort and match

I am retired so I have a lot of free time on my hands so I like playing the greyhounds. Using Excel I attempted to help myself save time by sorting out two columns at a time (Post - B-SPD) etc, because you have to sort some low and some high. The columns not marked Post are formula columns =abs(a3) etc. but when I try to sort the Post columns will sort, but the column I try to sort with it does not sort and match the post number it is assigned to.
Can this be done or does the =ABS formula prevent it. Plus even using =ABS some of the number are negative but the -minus sign does not appear. I have tried everything using numbers, using currency, using general, but nothing works. One person sent me to control panel to the Clock, Language, and Region settings. go additional setting and set your negative setting there. But that would not let the -minus sign show up on negative numbers either.
Is any of the above even possible?
POST B-SPD POST A-SPD POST 8TH POST L-SPD POST A-FIN
1 31.43 1 31.84 1 0 1 3 1 5.83
2 31.43 2 31.67 2 35.14 2 0 2 4.67
3 31.79 3 31.9 3 59.11 3 6 3 5.67
4 31.32 4 31.73 4 65.5 4 3 4 3.83
5 31.47 5 31.68 5 29.71 5 4 5 3.33
6 31.76 6 32.18 6 100 6 9 6 5.01
7 31.48 7 31.99 7 41.13 7 1 7 5.67
8 31.69 8 31.99 8 75.79 8 6 8 4.83
LOW LOW HIGH HIGH LOW
The requirement is not clear but use of ABS should not cause sorting issues. =ABS (for absolute) function is to strip out minus signs (so seems to be working properly).
OP may be advised to delete all but one of the POST columns, select headers and data (not including 'LOW' or 'HIGH') and Insert > Tables - Table, check My table has headers, OK, then use the filter buttons to choose whether to Sort Smallest to Largest or Sort Largest to Smallest for whichever attribute is to be ordered (the other columns will 'follow suit'). The filter button will show which button is determining the ordering and whether ascending or descending (eg table below is sorted descending on '8TH'):

rearranging data in excel

I'm not sure how to ask this question without illustrating it, so here goes:
I have results from a test which has tested peoples attitudes (scores 1-5) to different voices on a 16 different scales. The data set looks like this (where P1,P2,P3 are participants, A, B, C are voices)
Aformal Apleasant Acool Bformal etc
P1 2 3 1 4
P2 5 4 2 4
P3 1 2 4 3
However, I want to rearrange my data to look like this:
formal pleasant cool
P1A 3 3 5
P1B 2 1 6
P1C etc
P1D
This would mean a lot more rows (multiple rows per participant), and a lot fewer columns. Is it doable without having to manually reenter all the scores in a new excel file?
Sure, no problem. I just hacked this solution:
L M N O P Q
person# voice# formal pleasant cool
1 1 P1A 2 3 1
1 2 P1B 4 5 2
1 3 P1C 9 9 9
2 1 P2A 5 4 2
2 2 P2B 4 4 1
2 3 P2C 9 9 9
3 1 P3A 1 2 4
3 2 P3B 3 3 2
3 3 P3C 9 9 9
Basically, in columns L and M, I made two columns with index numbers. Voice numbers go from 1 to 3 and repeat every 3 rows because there are nv=3 voices (increase this if you have voices F, G, H...). Person numbers are also repeated for 3 rows each, because there are nv=3 voices.
To make the row headers (P1A, etc.), I used this formula: ="P" & L2 & CHAR(64+M2) at P1A and copied down.
To make the new table of values, I used this formula: =OFFSET(B$2,$L2-1,($M2-1)*3) at P1A-formal, and copied down and across. Note that B$2 corresponds to the cell address for P1-Aformal in the original table of values (your example).
I've used this indexing trick I don't know how many times to quickly rearrange tables of data inherited from other people.
EDIT: Note that the index columns are also made (semi)automatically using a formula. The first nv=3 rows are made manually, and then subsequent rows refer to them. For example, the formula in L5 is =L2+1 and the formula in M5 is =M2. Both are copied down to the end of the table.

Resources