Excel splitting one row into separate rows of a fixed number of colums - excel

Here is a sample of the data I have in one row in an excel file. I would like to split it into multiple rows after every seven columns
15-Feb 20 783 175 105 $180 $973 15-Mar 31 900 58 145 $106 $140
to
15-Feb 20 783 175 105 $180 $973
15-Mar 31 900 58 145 $106 $140

You can use this formula:
=INDEX($1:$1,INT(COLUMN()+(ROWS(A$5:A5)-1)*7))
drag/copy this formula across till row 7 and down as required.
Issue with this formula is it will return 0 if cell is blank.
So alternatively, you can check for cell blank condition and write formula as:
=IF(ISBLANK(INDEX($1:$1,INT(COLUMN()+(ROWS(A$5:A5)-1)*7))),"",INDEX($1:$1,INT(COLUMN()+(ROWS(A$5:A5)-1)*7)))

If you have a well defined and deterministic way to split the two halves (for instance, columns "A" to "D" is the first half, while columns "E" to "H" is the second), you can enter a formula in a different sheet like (this is pseudo-code; you will need to verify the syntax):
Cell "A1" of the new sheet: ='Other_Sheet'!A(round(row()/2)+1)
Cell "A2" of the new sheet: ='Other_Sheet'!E(round(row()/2)+1)
The indirect reference is made such that it will go to the next row in the source sheet every two rows in the new sheet.

Related

Excel horizontal list to columns

I am looking to format some data. To make it more easy I use an example with simple numbers.
Sheet 1 ('S1'):
A1 10
A2 14
A3 23
A4 12
A5 64
A6 32
.... etc
It is a long list(vertical) of 600 values
Now I want in Sheet 2('S2'):
To show it as:
S1!A1 S1!A2 S1!A3 S1!A4 S1!A5 S1!A6
S1!A7 S1!A8 S1!A9 S1!A10 S1!A11 S1!A12
S1!A13 S1!A14 S1!A15 S1!A16 S1!A17 S1!A18
References to the cells in the other sheet.
I have tried to transpose them but I cannot find a modifier to set an amount of columns used. i.e. I would get 1 row with all my data. I want only the first 6 in row, next 6 in next row, next 6... etc.
Thanks for any help/feedback given.
Put this in the upper left cell desired:
=INDEX(Sheet1!$A:$A,(ROW(1:1)-1)*6+COLUMN(A:A))
Then copy/drag over 6 columns and down till you finish the list
Sheet1

Excel 2010 columns contain more than one number, need to sum all numbers within the column from multiple rows

Need to SUM Excel columns where 1 row has several numbers within one column
Column B
Row1 68
136
68
Row2 1394
931
33
33
Row3 33
420
350
250
SUM B1:B3 only SUMs first number in cell ?? Help please.
I see no straightforward way to accomplish this.
However, you may flatten the cells into individual values.
Parallel to each cell, issue the formula
=SUBSTITUTE(A1, CHAR(10), ",")
This will make each cell comma separated. Your row one will become
68,136,68
You may then employ text to columns under the Data ribbon using the comma delimiter to give each number its own cell.
Thereafter you may rearrange the numbers and issue your SUM.
1] In C1 and copied down to suit:
="="&SUBSTITUTE(B1,CHAR(10),"+")
2] Copy ColumnC and Paste Special..., Values over the top, Replace All = with =.

Reference a cell of other worksheet while incrementing the Row number by 15 every time

I am trying to get value of sheet 1 cell "A19" in cell "A1" of sheet 2 and sheet 1 cell "A36" (which is 19+15) in cell "A2" of sheet 2. Do not want to use VBA as the number of rows in the sheets is high. have tried indirect function but havent been able to figure out how to reference cell from other workbook. is there any way this could be done?
In Sheet2, cell A1 enter:
=INDEX(Sheet1!A:A,19+(ROWS($1:1)-1)*17)
and copy down.
This will retrieve the data from these rows:
19
36
53
70
87
104
121
138
155
172
189
206
That is because the increment between 19 and 36 is 17.If you really want the increment to be 15, then substitute 15 in the top equation before the copy-down.
As you have said, you can also use INDIRECT , but INDIRECT is volatile so INDEX is a better choice
=INDIRECT("Sheet1!A"&1+(ROW()-1)*2)

Send data (Job #) in one column to another spreadsheet, if another column contains data

Here is a sample of the data I'm using. The letters are the estimated time in each area of the workshop (i.e. A. is clean up, B. is welding etc.):
J/C # A. B. C. D. E. F. G. H. TOTAL
97647 45 45 90 30 120 330
97651 15 30 45
97626
99999 60 120 75 360 615
11111 90 30 15 15 150
12345 10 20 30 40 50 60 70 80 360
On another sheet I need a column of all the Job Card numbers (J/C #) for each workshop area. I would like these automatically to appear when the budgeted time is put into this first sheet.
For example the Welding Sheet will have the following J/C #.
97647
99999
12345
I have been trying INDEX and MATCH and LOOKUP and VLOOKUP functions, but haven't yet found a solution.
Is this possible?
I have a solution that works -- hopefully I can explain it clearly.
Let's say your table is on "Sheet1". Create new sheets, one for each workshop (so, I have a "Sheet1", "A","B","C",...,"H").
In your "A" sheet, put this formula in A1:
=IFERROR(INDEX(Sheet1!$A$2:$A$10000,SMALL(IF(Sheet1!B$2:B$10000<>"",ROW(Sheet1!A$2:A$10000)-ROW(Sheet1!A$2)+1),ROWS(Sheet1!A$2:A2))),"") Enter with CTRL+SHIFT+ENTER and drag down.
This will create a population of those Job #s that have some value under the "A." column in "Sheet1".
To use this formula for your "B." column, put this formula in sheet "B", cell A1:
=IFERROR(INDEX(Sheet1!$A$2:$A$10000,SMALL(IF(Sheet1!C$2:C$10000<>"",ROW(Sheet1!A$2:A$10000)-ROW(Sheet1!A$2)+1),ROWS(Sheet1!A$2:A2))),"")
Notice the only change is in the "SMALL(IF(Sheet1!C$2:C$10000<>..." That's because since you want to return any job numbers for your "B." column, which is in Column C of Sheet1. ...so for your "C." Sheet, in A1, put the above formula but using column D for the "Small(If(Sheet1!C$2:C$10000" part.
Does this make sense?
The only thing is that you'll need to tweak depending on your sheet names (since I don't know what C,D,E, etc. actually refer to).

lump numeric values to totals within a range in Excel 2010

Given a column of numeric values, is it possible to sum values until the total reaches a particular threshhold, then reset the sum total and continue? for example
Val Sum
103
52 155
47
60
103 210
100
76 176
163 163
169 169
87
103 190
84
31
59 174
87
49
67 203
This sums groups of numbers until the value exceeds 150, then resets the counter.
i'll post it more for the proof of concept than a real answer or for the case i could improve this (Issun may have an idea too).
Here it is:
Let assume your Val is in column A and Sum in column B and Titles are in row 1.
In column C, we will set a formula that will tell which is the "last" cell where you sumed it up > in cell C3, put:
{=MAX(IF($B$2:B2=0;0;ROW($B$2:B2)))}
This is an array formula, you will have to validate with CtrlShiftEnter.
In cell B3, you will have to put the first value (155 in your example), sorry, i didn't find a proper workaround.
In cell B4, put:
=IF(SUM($A$1:A4)-SUM(INDIRECT("$B$1:"&ADDRESS(C4;2)))>150;SUM($A$1:A4)-SUM(INDIRECT("$B$1:"&ADDRESS(C4;2)));0)
Then drag & drop the formulas till the end of your values.
[EDIT] Actually, you could put it all in a single formula in cell B2:
{=IF(SUM($A$1:A2)-SUM(INDIRECT("$B$1:"&ADDRESS(MAX(IF($B$1:B1=0;0;ROW($B$1:B1)));2)))>150;SUM($A$1:A2)-SUM(INDIRECT("$B$1:"&ADDRESS(MAX(IF($B$1:B1=0;0;ROW($B$1:B1)));2)));0)}
and drag and drop it till the end of your values. Seems to work too.
Simplest way to do it (no need for array formulas let alone VBA):
In B2, type =IF(B1<150,B1+A2,A2) and drag down. This will sum until it reaches 150 or more, and then restart at zero. Of course, the intermediate sums (i.e. on the way up to 150) will show as well. If this bothers you, a couple of options spring to mind:
Type =IF(B2>=150,B2,"") in C2 and drag down, and hide column B.
Apply conditional formatting to column B such that numbers below 150 get shown in white font.
Here's a solution in VBA (sorry I know you wanted a forumula). You can obviously tweat the range to be whatver you need it to be. Please note I used LONG as data type (and I am casting to long to avoid some errors), but you need to use DOUBLE if you have any floating point numbers.
Sub SumIt()
Dim cell As range
Dim currentCount As Long
For Each cell In range("A2:A100")
currentCount = currentCount + CLng(cell.Value)
If currentCount > 150 Then
cell.Offset(0, 1).Value = currentCount
currentCount = 0
End If
Next
End Sub
How it works: I loop through each cell in the range and add the value to a variable called currentCount. I then check if it's over 150, if it is I paste the currentCount to the B column (same row) and reset the count and move to the next cell. Simple!

Resources