Excel - Drag and repeat formula pattern series - excel

I am trying to replicate a pattern of formulas in excel but it's not appearing the way I expect but I'm looking for a solution.
I have the first 2 rows in a table defined and it has 4 columns
The formulas are as follows:
A1 =CONCATENATE(Scores!D11," (",Scores!F11,")")
B1 =Scores!AF11
C1 =Scores!AH11
D1 =Scores!AH15
A2 =CONCATENATE(Scores!D17," (",Scores!F17,")")
B2 =Scores!AF17
C2 =Scores!AH17
D2 =Scores!AH21
I expected when I highlight the cells and dragged down that it would repeat the formula by adding 6 to all the value as shown above.
Is there an easy way to autofill the rows I need as I have to populate over 80 and possible more in the future.

If you use instead in A1:
=CONCATENATE(INDEX(Scores!D:D,11+6*(ROWS($1:1)-1))," (",INDEX(Scores!F:F,11+6*(ROWS($1:1)-1)),")")
then copy down as required, which has the additional benefit of avoiding volatile INDIRECT set-ups.
Regards

You could use Indirect() for the formulas to determine which row they are supposed to go after. Basing the logic off of the current row on which the formula resides:
In A1:
=Concatenate(Indirect("Scores!D" & (11 + (Row()-1)*6)), " (", Indirect("Scores!F" & (11 + (Row()-1)*6)), ")")
In B1:
=Indirect("Scores!AF" & (11 + (Row()-1)*6))
You can see what's happening more clearly in that B1 example. We are dynamically determining the number 11 by using that formula 11 + (Row()-1)*6. For B1 the ROW() returns 0, so the formula is 11+(0-1)*6 or 11. That 11 is concatenated with Scores!AF and then Indirect() returns that back to the formula so it can then look up Scores!AF11 from the workbook and return it's value.
When you copy that formula down to B2 the ROW() returns 2 and the formula then works out to 17, which is your B1 value + 6.
That's a few hops, skips, and jumps to get what you need, but the formula will copy down nicely and save you a lot of typing.

Related

How to auto fill periodic content in Excel that is not counting up like the rows

Let’s assume I have eight excel cells (A1:A8) with the following content:
=MID(B1,1,2)
=MID(B1,3,2)
=MID(B1,5,2)
=MID(B1,7,2)
=MID(B1,9,2)
=MID(B1,11,2)
=MID(B1,13,2)
=MID(B1,15,2)
Now I mark it and drag it down to the next eight cells. I would like to get the same eight formulas just with B2 instead of B1, but excel is giving me B9 for all cells because 9 is the row number of the first new cell.
How can I tell excel that I want to have B2 in the auto fill (and B3 for the next eight and so on)? It is to much data in order to write it all by hand.
Thank you
Put this in A1 and copy down:
=MID(INDEX(B:B,INT((ROW($ZZ1)-1)/8)+1),MOD(ROW($ZZ1)-1,8)*2+1,2)
It will adjust to the next value in column B every 8 rows and will do the 1,3,5,7,...,15 in the start of the MID. No need for any other formula.
Or, since you stated you have Office 365 put this in A1 and it will spill the results:
=MID(INDEX(B:B,INT(SEQUENCE(COUNTA(B:B)*8,,0)/8)+1),MOD(SEQUENCE(COUNTA(B:B)*8,,0),8)*2+1,2)
If you want to keep your original formula, this will involve 4 steps:
Place the following formula in cell A1
="=MID(" & "B" & ROUNDUP(ROW(B1)/8, 0) & ", " & MOD(ROW(B1)-1,8) * 2 + 1 & ", 2)"
Copy down as far as needed.
Select whole of column A, Copy, Paste Special > Values
Select whole of Column A, Ctrl+H (Replace), Find what "=", Replace with "=", Replace All.
This will create formulas in Column A is in your question.

Excel formula to Sum 12 rows every 3 rows

I need to make a sum of 12 rows every 3 rows in excel. That is, I need to sum first from C4 to C15, then from C7 to C18, and so on.
You can use OFFSET function for this, also volatile, but shorter!
Assuming first formula in E2 copied down
=SUM(OFFSET(C$4,(ROWS(E$2:E2)-1)*3,0,12))
I prefer this because it explicitly contains all the required information
C4 = first cell to sum,
E2 = first cell with formula,
3 = row increment,
12 = number of cells to sum
The above gives you the sums on successive rows from E2 (or any other chosen cell) down. If you actually want the sum to be shown every 3 cells e.g. on the first row for each sum then that's simpler - try this formula in D4 copied down
=IF(MOD(ROWS(E$2:E2),3)=1,SUM(C4:C15),"")
.......or even easier.....just put this formula in D4
=SUM(C4:C15)
....leave D5 and D6 blank, then select the range D4:D6 and drag down
You can also use the non-volatile INDEX function
=SUM(INDEX(C:C,ROWS($1:1)*3+1):INDEX(C:C,ROWS($1:1)*3+12))
This works because INDEX returns a reference so you can use the normal Ref1:Ref2 notation for a range.
=SUM(INDIRECT("C"&ROW(1:1)*3+1&":C"&ROW(1:1)*3+12))
Be warned that INDIRECT() is a volatile formula... This means that any change made anywhere in the workbook this formula will recalculate and can cause performance issues.

(Excel 2013) Combining two cell value without exceeding certain characters limit

I've tried to solve this with excel formula but it is too complicated as I need the workbook to be as less clustered with formulas. So I turned to VBA for aid. So far all the VBA that I've found was mainly for trimming single cell characters only.
What I need for my project is as follows:
A1-Name
B1-Colour
C1-Name(Colour)
If LEN(C1) is less than 81 then nothing is trim. Else, TRIM A1 only without changing B1 so the end result is LEN(C1) is always less than 81.
Thanks.
Edit:
Excel Screenshot 1
What I've tried is:
-I will do "len" on B2 in cell AA2 then another "len" on C2 in cell AB2.
-Then I combine B2 and C2 in cell D2.
-Do another "len" for cell D2 in cell E2.
-If the value in E2 exceed 80, then I've to do "right" for cell B2 in another cell.The value that will be deducted from cell B2 is AA2-80+AB2.
-Once it is done, the new trim B2 will be recombine with C2 in another cell.
That is too many new cells. As you can see, I've to hide some cells that make up what is inside cell F2. So here I am. Beaming up that spotlight with that letter "E" so that Excelman will come to the rescue.
A very simple Excel formula which should do what you want is
=LEFT(A1,MAX(0,78-LEN(B1))) & "(" & B1 & ")"
i.e. take as many characters as possible from A1 so that, when concatenated to "("&B1&")", the total won't exceed 80 characters, and then concatenate that to the "("&B1&")".
Note: Cell references in the formula above are based on your original question. Based on the screenshot, and the edits to your question, the formula would be:
=LEFT(B2,MAX(0,78-LEN(C2))) & "(" & C2 & ")"
If you definitely need VBA, you can use the same functions (i.e. Left and Len) and the same operators (i.e. - and &) in VBA as are used in Excel. The only problem is MAX, which will need to be replaced with Application.Max or with an If statement.

Excel Formula / VBA

I wonder if you can help, I am working on a spread sheet where Column B is populated with data.
What I want to be able to do is to say (using b3 as an example)
If B3 is populated then A2+1. I am using this formula in cell a3:
=IF(B2 > 0, A2 +1)
which gives me the result I want but when I hit a blank cell in B it starts the count over again. so I tried:
=IF(B2 > 0,A2 +1,A1 + 1)
but that counts my blank spaces. I need it to continue the count from the cell above without counting blank spaces. I have also tried applying the formula through pentaho to no avail.
It would be good if the formula actively looked and populated Column A instead of a manual formula having to be copied.
I have also used the COUNTIF function but I don't seem to be able to get it to work.
I hope this makes sense.
With column B like:
Place a starting value in A2 and in A3 enter:
=IF(B2>0,MAX($A$1:A2)+1,"")
and copy down:

Copy from sheet 1 to sheet 2 every 50th row

I need to copy data from tab1(sheet 1) to tab2(sheet2) every 50 lines. I can get it to do it manually, but when I try and copy the formula down after setting up a few cells it gives me random cells not every 50 like what was in the previous formulas.
If you place this formula in row 1 of any column it will return the proper pattern (2, 52, 102...)
=INDIRECT("A" & 2 + 50*(ROW()-1))
However note that INDIRECT is a volatile formula. This will slow your workbook if you have a lot of calculations and a lot of calls to INDIRECT().
in sheet2!A1, use the following formula, then copy down:
=OFFSET(Sheet1!$A$1,1+(ROW()-1)*50,0,,)
You could use Index and Row to achieve this..
for example the following formula in column B
=INDEX(A:A,(ROW()-1)*50+2,0)
will return back
B1 = A2
B2 = A52
B3 = A102
....

Resources