Im trying to duplicate data down a set of columns based on number cycle. Every time a number in sequence repeats, I'd like the number IM populating to increase by 1.
For example:
A
B
1
1
1
2
1
4
2
1
2
2
2
4
Every time column B repeats its cycle, In this case when it repeats back to 1, 2 ect. I'd like column A to increase by 1.
Initially I thought something like =IF(A3<>A2,B2+1,B2) would suffice, but that repeats.
Is there a different formula I can use to accomplish this?
Depending on your scenario, I'd do this.
These formulas need to originate in cell A2. If you're not working in the top left hand corner of your sheet, you'll need to adjust the formula accordingly.
Scenario 1 - All numbers in the sequence are unique.
=IF(INDIRECT(SUBSTITUTE(ADDRESS(1,B2),"1","") & "1") = B2, MAX($A$1:A1) + 1, MAX($A$1:A1))
Scenario 2 - All numbers in the sequence are NOT unique.
=IF(SUMIF($A$1:A1, MAX($A$1:A1), $A$1:A1) / 6 = MAX($A$1:A1), MAX($A$1:A1) + 1, MAX($A$1:A1))
Related
I need a count of how many date items fall within Data 1 & Data 2
ie:
x-1 will have a count of 2
x-2 will have a count of 1
-x-3 will have a count of 2
-y-1 will have a count of 2
What would be the best way to go abouts when approaching this?
Data 1
Data 2
Date
x
1
Date 1
x
1
Date 1
x
1
Date 2
x
2
Date 3
x
2
Date 3
y
1
Date 1
y
1
Date 1
I see only one way to interpret with the available information:
To count the number of times Date_to_test falls within Date_1 and Date_2 (screenshot below, sheet here), you could use either the sum or something like a countifs (with interim calc):
sum approach
=SUM(1*($C$2:$C$11<=$B$2:$B$11)*($A$2:$A$11<=$C$2:$C$11))
countifs + interim calc
helper
=1*(C2<=B2)*(A2<=C2)
(additional column, drag down)
countifs
=COUNTIFS($D$2:$D$11,1)
Screenshot
Alternative
as for the 'sum' approach, sumproduct variants (e.g. =SUMPRODUCT(1*($C$2:$C$11<=$B$2:$B$11),1*($B$2:$B$11>=$A$2:$A$11))) are calculation/memory intensive
despite the countifs + helper approach containing more 'visible' data - these values need only be calculated once, the countifs can then be determined independently (assuming no updates to the helper column) - thus making it more memory/calculation efficient depending upon your calculation mode, screen-updating preferences
Caveat
if, by some misfortune re: interpreting your question, you are referring to some other means of establishing whether "date items fall within Data 1 & Data 2", then without knowing what this is, there very low likelihood of being able to guess this correctly
Hello I have a table shown below where I have letters in column 1, and min and max ranges for column 2 and 3. I am trying to retrieve the final number in column 4.
I know I can use a VLOOKUP and set the range as TRUE to get the last column. However, how would I factor in multiple columns/criteria to find match the correct range with the correct letter.
For example, I can would like to get value 4 from the last column. I would have to match with "B" and it would be between 0 and $50,000.
A 0 $50,000 1
A $50,001 $100,000 2
A $100,001 $250,000 3
B 0 $50,000 4
B $50,001 $100,000 5
B $100,001 $250,000 6
C 0 $50,000 7
C $50,001 $100,000 8
C $100,001 $250,000 9
Thank you!
Two ways:
If the pattern is the same as to the breaks of the dollar amounts then use this:
=INDEX(D:D,MATCH(G1,A:A,0)+MATCH(H1,$B$1:$B$3)-1)
Where MATCH(G1,A:A,0) returns the first row where the ID is located and MATCH(H1,$B$1:$B$3) finds the relative location of the price in the first pattern. Change $B$1:$B$3 to encompass the whole pattern.
If the patterns are different then you can use this:
=SUMIFS(D:D,A:A,G1,B:B,"<=" & H1,C:C,">=" & H1)
One more for the future when Microsoft releases FILTER():
=FILTER(D:D,(A:A=G1)*(B:B<=H1)*(C:C>=H1))
This is entered normally and does not matter the pattern.
I have a list of numbers which are either 1's or 2's. What I'd like to do is count how many 1's there are before a 2 appears, and then keep repeating this down the list (i'm trying to find the average number of 1's between each 2).
What would be the best way of doing this considering I've got over 10,000 rows? (i.e. too many to do manually)
The average number of 1's between each number 2, is the same as the ratio between the number 1 and the number 2.
Example:
1
1
2
1
1
1
1
2
1
1
2
1
1
2
Contains 10 ones and 4 twos.
Or there are five groups of ones, with the following counts: 2, 4, 2, 2
Either way, it will give you and average of 2.5 (10/4 = 2.5)
Note: You have to make a design choice, regarding how to handle beginnings and ends. If you had another one, after the last two, how should it be handled?
You can use the formula as shown in the screenshot below:
Note that the formula in the first row is different.
B C
=IF(A2=1,B1,B1+1) =COUNTIF(B:B,B2)
=IF(A3=1,B2,B2+1) =IFERROR(IF(A4=2,COUNTIF(B:B,B4),"")-1,"")
Then to get the average use:
=AVERAGEIF(C:C,"<>"&0)
Noceo's solution as a formula:
=COUNTIF(A:A,1)/COUNTIF(A:A,2)
The output of all the above:
i would like to count number for every 7 rows, data are in one column. i use this formula, but it is not working.
from B8 to B14329, for every 7 rows, count number if it is equal to 3. so i know how many 3 in every 7 rows.
=COUNTIFS(B8:B14329, OFFSET($B$7,(ROW()-12)*7,0,7,1),B8:B14329,=3)
Thanks a lot!
i want something like this:
data count
3
2
3
1
3
3
1 4
1
2
2
3
3
1
1 2
.....
....
...
Simple and easy:
=SUMPRODUCT((B8:B14329=3)*(MOD(ROW(B8:B14329),7)=1))
Just change the =1 to your needs. To start with row 1 =1, 2 =2 ... 6 =6, 7 =0. This way, to start count at row 8 it is =1
EDIT: having your exaple now, you want something completely different... lol.
=IF(MOD(ROW(),7)=0,COUNTIF(A8:A14,3),"")
Put this in row 14 and then drag down... change the =0 as you need it.
Here's what I would do
Add a new column with the row index (8 to 14239) in your case
Add Yet another column, with a formula to tell whether the column you just added is a multiple of 7. Put it's value like "TRUE" or "FALSE"
You can use the MOD function to check the remainder of the division.
= MOD ( Number , Divisor )
By now, you should have, aside from the columns you already have, something like:
8-----FALSE
9-----FALSE
10-----FALSE
11-----FALSE
12-----FALSE
13-----FALSE
14-----TRUE
15-----FALSE
Once you have that, just apply a filter on the "TRUE/FALSE" column, select the "TRUE" values and you will be able to count the number of "3"s on the actual value column, by also using a filter on it.
I hope it helps, and it's easier than a really messy formula.
I am stuff on a problem regarding setting up a dynamic shift rota at work.
What it has to do is there are 3 people per team and 3 jobs to do (which they do as equals as it can be per week) and when someone is off lets call it job 3 is just not done that day.
I have been able to make it to set true or false if there in but having trouble with assigning a different job per day with priority on job numbers 1 and 2.
edit: I thought I would explain it better what I am looking for
alt text http://img688.imageshack.us/img688/3032/spreadsheet.jpg
This is the spreadsheet i have at the top is the rota 1 = in 0 = day off
I have only been working on Group 3 to get it working, In the grey next to the days at the bottom are the jobs in which that person would be doing if it was a full staff day.
What i need to do is if there are only 2 people in then they do job number 1 and 2 alternativly .
i currently have this formula it works for some combo but not all (this is formula for H33)
=IF(F9 > 0, IF(OR(F9=0,F10=0,F11 = 0),IF(OR(I33 = 1, I33 = 2),I33,I33-1),I33), 0)
Any advise woudl be great
Use this formula for John (column C row 4), and the copy it down to the other 2 people in the same day
=IF(B4="in",COUNTIF(B4:B$4,"in"),"")
for next day you should change the B$4 to B$8, etc
EDIT / I did not undestand your rotation pattern
Now, refering to the excel image you posted, for Group 1, Monday
You need two auxiliar columns
1. In P11-> =D3*E23 // To eliminate zeroes
2. Copy down P11 till P13
3. In Q11-> =IF(P11=0,"",RANK(P11,P$11:P$13,-1)) // To get 1, 2 or 3 values
4. Copy down Q11 till Q13
5. In D23 -> =IFERROR(Q11-MIN(Q$11:Q$13)+1,"") // Offset Factor 1,1-2,1-3
4. Copy down D23 till D25
It was a tricky one