excel incrementation by consecutive numbers - excel

I have a form, thanks to user JamTay317, That lists data depending on folder number (bold number in form). I need to copy it for all 1500 folders (about 400 pages)
Form is divided on 4 labels on a page for easier printing
form overview
Form get it's folder number (nr teczki) from list with all folders from another sheet called "lista teczek":
list of folders
For first 4 folder numbers I use formula:
A2='lista teczek'!A1
J2='lista teczek'!A2
A21='lista teczek'!A3
J21='lista teczek'!A4
When I copy whole page underneath it increments by 36 (number of rows between)
A38='lista teczek'!A37
J38='lista teczek'!A38
A57='lista teczek'!A39
J38='lista teczek'!A40
Instead of A5, A6, etc.
Is there any way to override excel's incrementation to force it to use consecutive numbers? Or at least formula which will make it easier to follow folders list?

So I would use offset() to get the correct position
=A2=OFFSET('lista teczek'!$A$1;ROW(A1)-INT(ROW(A1)/36)*36+4*INT(ROW(A1)/36)-1;0)
So this will offset from A1 in the list sheet.
Below are row numbers a resultant lookup row numbers
Note the formula I used in the offset has an extra "-1" as this is an OFFSET so to get 1 from 1 we need to offset by 0
1 1
2 2
3 3
4 4
37 5
38 6
39 7
40 8
73 9
74 10
75 11
76 12
109 13
110 14
111 15
112 16
145 17
146 18
147 19
----LOGIC--- (edit)
So the idea is that you work out the occurrence you are on. Int(row()/36) gives us this. For example
int(1/36)=0
Int(363/36)=10
First part gives us the offset from the start of the occurrence
3-int(3/36)*36=3
378-Int(363/36)*36=3
Second part give the total of the previous occurrence
4*int(3/36)=0
4*Int(363/36)*36=40
So you need to change the 36 to the gap between the occurrences and the 4 to the length of occurrences Not sure if that helps to explain

Related

Sumif of multiple Index matches against one value

Need help regarding Excel dynamically search based sum of two columns matching from two different tables.
I have got this Table of Data Entered One Time
A B C
1 Qlty Warp Weft
2 Stpl.1 150 20
3 Cotn.1 80 60
4 Stpl.2 20 20
5 Cotn.2 20 20
6 Stpl.3 20 40
in Column A2:A6, Quality can not be duplicated, its a unique Name
The Data entry and report Table is here
A B C D E F
8 Yarn Name Sent Bags Remaining Qualty Used Warp Used Weft
9 20 800 600 Stpl.1 71 200
10 150 101 30 Stpl.2 70 30
11 40 300 290 Stpl.3 100 10
12 20 400
C9:C5000 is Returning Column, Values are calculated on the base of Column A9:A5000 (Yarn Name)
Need to Find Yarn Name (eg:) "20" in B2:B6 AND/OR C2:C6, wherever it matches, index that Quality from A2:A6
Then match the returned qualities(could be more than one) to D9:D5000 and sum the mathced results from E9:F5000
I have tried so far in C12
=SUMIF($A$9:$A12,A12,$B$9:$B12)-(SUMIF($D$9:$D12,INDEX($A$2:$A$6,MATCH(A12,$B$2:$B$6,0)),$D$9:$D12)+SUMIF($D$9:$D12,INDEX($A$2:$A$6,MATCH(A12,$C$2:$C$6,0)),$D$9:$D12))
PS:- I am using Excel 2007
If I understand correctly, then following array formula can help you:
=SUM(IFERROR(INDEX($A$2:$A$6,N(IF(1,(MMULT(--($B$2:$C$6=A9),TRANSPOSE(COLUMN($B$2:$C$6)^0))>0)*(ROW($B$2:$C$6))-1)))=TRANSPOSE($D$9:$D$12),0)*TRANSPOSE($E$9:$E$12+$F$9:$F$12))
Array formula after editing is confirmed by pressing ctrl + shift + enter
Edit:
To calculate Warp and Weft columns separately use following array formula:
=SUM(IFERROR(INDEX($A$2:$A$6,N(IF(1,((A9=$B$2:$B$6)*ROW($B$2:$B$6))-1)))=TRANSPOSE($D$9:$D$12),0)*TRANSPOSE($E$9:$E$12))+SUM(IFERROR(INDEX($A$2:$A$6,N(IF(1,((A9=$C$2:$C$6)*ROW($C$2:$C$6))-1)))=TRANSPOSE($D$9:$D$12),0)*TRANSPOSE($F$9:$F$12))

Sorting Logic - Excel formula

All, I am trying to do the following in Excel
Take 2 rows each time say leg 1 and leg 2, check which of the values in column ISO value comes first and populate column Alphabetical order with either 'First' or 'Second'
For eg: for the first 2 rows,110 comes before 150 so the values for alphabetical order will be First and Second.
I want to repeat the same logic for leg 3 and leg 4 and then for leg 1,leg2 and so on.
Any ideas how to achieve this using Excel functions (the table is sorted on leg number)?
**Leg Number ISO Value Alhpabetical order**
1 110 First
2 150 Second
3 110 First
4 150 Second
1 8 First
2 150 Second
3 8 First
4 150 Second
1 150 Second
2 74 First
3 150 Second
4 74 First
1 74 First
2 150 Second
3 174 Second
4 150 First
IF(ISODD(ROW()),IF(OR(B2=B1,B2< B1),"First","Second"),IF(ISEVEN(ROW()),IF(OR(B2=B3,B2< B3),"First","Second"))). Put this formula in Cell C2 and copy down as needed.

Find all rows that contains 4 specific values?

I am using excel and I have a table of numbers with 6 columns from A to F and more than 1000 rows. For example, from my table,
4 17 37 38 47 53
8 43 54 55 56 60
4 18 21 25 38 57
15 25 37 38 58 59
4 16 19 20 27 43
18 32 47 50 54 56
i want to find if there is at least a row (it must be a row!) that contains the numbers 16 19 20 27. From this example, there is a match, but i don't know how to make a search or formula using four diferent numbers.
I feel like I need to use the match function but can't quite figure it out and I'm not sure about it. Does anyone know how to do this?
Thanks!
This should work:
=IF(AND(OR(A1=16,B1=16,C1=16,D1=16,E1=16,F1=16),OR(A1=19,B1=19,C1=19,D1=19,E1=19,F1=19),OR(A1=20,B1=20,C1=20,D1=20,E1=20,F1=20),OR(A1=27,B1=27,C1=27,D1=27,E1=27,F1=27)),"Yes","No")
Put it in a new column in the table. It will return a Yes if the row contains all 4 values, and a No otherwise. You can then filter the new column of Yes/No to search for a row with Yes
I put the four values you are seeking in I1:L1 and the array of data to be searched in A1:F#. Then in column G create a helper column that concatenates A:F into a delimited string. The formula in G1 is:
=":"&A1&":"&B1&":"&C1&":"&D1&":"&E1&":"&F1&":"
where I've used ":" for the delimiter (you can use any char that's not in your data).
The result in G1 is:
:4:17:37:38:47:53:
Now in H1 use this formula to search:
=NOT(ISERR(FIND(":"&$I$1&":",G1)*FIND(":"&$J$1&":",G1)*FIND(":"&$K$1&":",G1)*FIND(":"&$L$1&":",G1)))
Each FIND will return an INT if the value (with leading and trailing delimiters) is found and #VALUE! otherwise. So the product will be an INT if all values are found and #VALUE! otherwise. Wrapping the FINDs inside an ISERR makes the result prettier (TRUE/FALSE instead of #VALUE!), and inverting with NOT returns TRUE when all 4 values are found and FALSE otherwise.
Hope that helps.
Here's another way --- more elegant (no helper column). As before, I put the four values you are seeking in I1:L1 and the array of data to be searched in A1:F#. Then in column G use this ARRAY formula (CTRL-SHIFT-ENTER):
=NOT(OR(PRODUCT(A1:F1-$I$1)<>0,PRODUCT(A1:F1-$J$1)<>0,PRODUCT(A1:F1-$K$1)<>0,PRODUCT(A1:F1-$L$1)<>0))
Each PRODUCT term checks for the existence of one value and returns 0 when the value is found and a non-zero value otherwise. The results of each of the four PRODUCT terms is tested with <>0 which will return TRUE if a value is not found. Then OR with return TRUE if one or more values are not found and FALSE if all are found. That result is wrapped in a NOT so that the function result is TRUE when all four values are found.

Subtotals in excel should repeat

Below is my data in excelsheet :
RID RNO RCOST
----------------
11 2 78
11 3 30
22 6 20
22 8 34
Need to display the subtotal of RCOST grouped on RID as :
RID RNO RCOST
----------------
11 2 108
11 3 108
22 6 54
22 8 54
I am able to calculate the subtotals but unable to populate the same subtotal for all the rows in that particular group.
Please provide some inputs
If you don't plan to keep the original RCost numbers, you will need VBA to collect the conditional sum based on RID then write that total into the RCost column for each RID. If you are planning on keeping the original RCost numbers then a simple SUMIF or SUMIFS function in a new column should suffice. In an unused column to the right,
=sumif(A:A, A2, C:C)
Fill down as necessary.

Extracting the upper quartile data from an array and placing it in new column

Hi and thanks for any help with this in advance
Below is a hypothetical data set; abundance = count data; mud% = the mud content in which the animals were found; mud bin = bins i've made up depending on the mud%; and UQ = upper quartile of the abundance data from its corresponding mud bin (i.e. the upper quartile for the abundance data in mud bin 1 is 17.25 etc).
Problem:
In excel, for abundance data in each of the four mud bins, I'm wanting to extract any values in the abundance column that are >= the upper quartile value for that particular mud bin and place these in a new column on the same sheet (with no gaps between rows from values that didn't meet the criteria) along with their corresponding mud% value in the neighboring cell. I've added the new columns to the below sheet to give you an idea of what I'm after.
abundance | mud% | mud bin | UQ | | New column | Mud% |
18 10.9 1 18 10.9(mud bid 1)
15 6.5 1 44 38.9(mud bin 1)
6 13.4 1 45 38 (mud bin 2)
13 42.1 1 37 37.8(mud bin 2)
15 36.4 1 etc
44 38.9 1 17.25 etc
22 46 2
30 36.4 2
45 38 2
29 35.3 2
37 37.8 2
29 41.8 2 35.25
11 44.4 3
17 47.8 3
21 40.7 3
15 13.9 3
35 13.9 3
14 13.9 3
15 13.9 3 19
19 12 4
14 12 4
10 12 4
12 12 4
14 12 4
13 12 4
45 9.525 4
66 9.525 4
78 9.525 4 45
The reality is I have a rather large dataset containing abundance data for a number of species, all on the same excel sheet and would greatly appreciate any insight into how I might achieve this in the most efficient manor.
For starters, to make this explanation simpler, I will assume that the last row of data is in row 100.
Populate Upper Quartile values for all line items
First you'll need to use the Quartile formula; however, since you want to find the upper quartile within a bin, you'll have to use an array formula. Put this formula in your UQ column (place in cell D2 and drag down). When entering the formula Be sure to press Ctrl+Shift before pressing Enter
=QUARTILE(IF($C$2:$C$100=C2,$A$2:$A$100,""),3)
The first part of this formula, $C$2:$C$100=C2 is your condition. Everywhere this condition is met, you will get the corresponding value in $A$2:$A$100; otherwise, you'll get a blank value. This will give you an array of abundance values that matches the indicated mudbin, C2. now that you have your subset of data, the quartile function will give you the value in the 3rd quartile (17.25 for mudbin 1, which will be placed next to every row that has a mudbin of 1).
Now that we have all the quartiles, we can get all the abundance values that are greater than the UQ for that mudbin. This is done in two parts
Get abundance values greater than mudbin UQ
First, you need to select one column of cells that has the same number of rows as your data (for example, select cells F2:F100)
Enter the following formula into the formula bar (while F2:F100 are highlighted) and press Ctrl+Shift, then enter
=IF($A$2:$A$100>$D$2:$D$100,$A$2:$A$100,"")
Similar to the IF statement used before, this formula finds all the abundance values that are greater than their corresponding UQ value. Now column F will have an abundance number where it is greater than it's UQ value, and a blank where it is not. Now onto the final step.
Populate abundance values that are greater than the UQ value, without the blanks
Select G2:G100 (your "New Column" in your sample data)
Enter the following formula into the formula bar (while G2:G100 are highlighted) and press Ctrl+Shift, then enter
=INDEX(F2:F100,SMALL(IF(F2:F100<>"",ROW(F2:F100)-1),ROW()-ROW($F$1)))
Looking at the IF statement again, this will find every value in F2:F100 that is not blank, but instead of grabbing the values, we'll keep track of the row number of that non blank value (done by ROW(F2:F100)-1
). Now that we have the row numbers of all the non blank values, we can grab the non-blank values in order and populate them in G2:G100. ROW()-ROW($F$1) is a counter, and SMALL will use the counter to determine the nth smallest number to return. Once we have our row number of the non blank value, INDEX returns that value
Finally, to populate the Mud%, you'll need to use the row number of the non blank values to get the mud% and the mud bin (You have the formula already to get the row number of the non blank value).
It's not a simple answer, but at least you won't have to use VBA.

Resources