I have hundreds of rows data in vertical columns. I want to rearrange it in rows.....
Image is attached what I want to achieve.....
your valuable Help is appreciated...
A19 = 2
A20 = A19 + 3
B19 = =INDIRECT("A" & $A19)
C19 = =INDIRECT("B" & $A19)
D19 = =INDIRECT("C" & $A19)
E19 = =INDIRECT("C" & $A19 + 1)
F19 = =INDIRECT("C" & $A19 + 2)
G19 = =INDIRECT("D" & $A19)
H19 = =INDIRECT("D" & $A19 + 1)
I19 = =INDIRECT("D" & $A19 + 2)
J19 = =INDIRECT("E" & $A19)
K19 = =INDIRECT("E" & $A19 + 1)
L19 = =INDIRECT("E" & $A19 + 2)
... now fill down as far as you need but be careful filling down column A from A19, you need to fill down from A20.
You can make it more dynamic by putting the column letters above your headers if you want but that's up to you.
There are a few ways to do what you want and you may find an easier way.
enter image description here
Check Above Sample Pic
Related
Cell A2 contains value "25-86".
I need cell B2 to have value "AJ 2586%"
This code reveals Syntax error:
Range("B2").Value = "AJ & Left(Range("A2"), 2) & Right(Range("A2"), 2) & %"
If I write it like that
Range("B2").Value = "AJ & Left(A2, 2) & Right(A2, 2) & %"
The functions Left and Right treat "A2" as string.
How could I extract a part of text from the cell and enter it in another cell?
The issue is that everything between the " " defines a string.
You can type your code like this:
Range("B2").Value = "AJ " & Left(Range("A2"), 2) & Right(Range("A2"), 2) & "%"
The following formula will return the value as a real percentage that you can use in calculations.
It just removes the - from the figure.
=SUBSTITUTE(A2,"-","")/100
Initially it will display the value as 25.86.
When you apply the custom number format of:
\AJ 0%
It will then display as AJ 2586%.
If that formula is in A1 then =A1/2 will return AJ 1293%.
Edit:
Just realised you want it in VBA:
Range("B2") = Replace(Range("A2"), "-", "") / 100
Range("B2").NumberFormat = "\AJ 0%"
Or, if you just want it as text:
Range("B2") = "AJ " & Replace(Range("A2"), "-", "") & "%"
Range("B2").Value = "AJ " + Left(Range("A2"), 2) + Right(Range("A2"), 2) + "%"
Indent code 4 spaces in order for it to be in the correct format
So I have this formula source here
=REPT(CHAR(9); CODE(A1)-65) & SUMPRODUCT(($A$1:$A$200="A")*(ROW($A$1:$A$200)<=ROW(A1)-1)) & "." & IF(CODE(A1)>65;SUMPRODUCT(($A$1:$A$200="B")*(ROW($A$1:$A$200)<=ROW(A1))*(ROW($A$1:$A$200)>=MAX(ROW($A$1:$A$200)*($A$1:$A$200="A")*(ROW($A$1:$A$200)<=ROW(A1))))) & ".";"") & IF(CODE(A1)>66;SUMPRODUCT(($A$1:$A$200="C")*(ROW($A$1:$A$200)<=ROW(A1))*(ROW($A$1:$A$200)>=MAX(ROW($A$1:$A$200)*($A$1:$A$200="B")*(ROW($A$1:$A$200)<=ROW(A1))))) & ".";"") & CHAR(9) & B1
Which give us this:
The question is: How do I start from 0?
Starting from zero mean,
Title 1 = 0. Title 1
Title 2 = 1. Title 2
Subtitle 3 = 1.1 Subtitle 3
Just found the solution, you need too Subtract 1 from the first SUMPRODUCT
Thanks for you help everyone
=REPT(CHAR(9); CODE(A1)-65) & SUMPRODUCT(($A$1:$A$200="A")*(ROW($A$1:$A$200)<=ROW(A1)))-1 & "." & IF(CODE(A1)>65;SUMPRODUCT(($A$1:$A$200="B")*(ROW($A$1:$A$200)<=ROW(A1))*(ROW($A$1:$A$200)>=MAX(ROW($A$1:$A$200)*($A$1:$A$200="A")*(ROW($A$1:$A$200)<=ROW(A1))))) & ".";"") & IF(CODE(A1)>66;SUMPRODUCT(($A$1:$A$200="C")*(ROW($A$1:$A$200)<=ROW(A1))*(ROW($A$1:$A$200)>=MAX(ROW($A$1:$A$200)*($A$1:$A$200="B")*(ROW($A$1:$A$200)<=ROW(A1))))) & ".";"") & CHAR(9) & B1
In general, to create a column of values starting from zero and increasing by one, pick any cell and enter:
=ROWS($1:1)-1
and copy downward.
I have the following data where A to C are the columns:
A B C
-5.274 -20.63 9.251
where each number is in a different cell.
I want to combine these numbers in the following way and paste them into a new cell (those of column D)
-5.274 (-20.63 − 9.251)
How can I do this?
You can't copy and paste them like that, but you can very easily:
D2: =A2 & " (" & B2 & " - " & C2 & ")"
To keep the formatting:
=TEXT(A1;"0.00")& "(" & TEXT(B1;"0.00") & " " & TEXT(C1;"0.00") & ")"
I need to add sequential numbering order in excel based on the list position of data within excel. I have tried many things to get this right but surely there must be an easy solution.
As you can see my data is an ordered list of text where you can see the hierarchy in the offset of data down the rows. I am trying to automatically create the yellow picture based on the data from the left side.
The only solution I have come up with is to add columns in front of each column, filter the records based on non-blanks then work from left to right manually adding the sequence, but even this is too time intensive.
Ill be working on a macro next but thought there may be an easier solution using a formula. - will update if found.
This is probably not the most efficient solution, but it works:
Formula in G2 (fill the rest of the area with it):
=IF(ISBLANK(A2),IF(ISBLANK(B2),G1,G1+1),0)
Formula in L2 (fill the rest of the area with it):
=IF(G2>0,K2&"."&G2,"")
Formula in Q2 (fill the rest of the area with it):
=IF(ISBLANK(B2),"",MID(L2,2,LEN(L2))&" - "&B2)
You can easily use it for any depth by increasing the areas size, but you need an empty top row and empty column on the left of each area to make it work.
You could probably skip L:O area by combining the last two formulas.
Result:
Formulas: (blue are constants, orange are for the first hierarchy level, green are dragged in the box)
Sub Sequential_Numbering()
Dim tmpRange As Range, tmpArray(1 To 4) As Integer, x As Integer
Set tmpRange = Range("A1")
tmpArray(1) = 1
tmpRange.Value = tmpArray(1) & " - " & tmpRange.Value
For x = 2 To 13
Set tmpRange = Rows(x).Find(What:="*")
Select Case tmpRange.Column
Case 1
tmpArray(1) = tmpArray(1) + 1
tmpArray(2) = 0
tmpArray(3) = 0
tmpArray(4) = 0
tmpRange.Value = tmpArray(1) & " - " & tmpRange.Value
Case 2
tmpArray(2) = tmpArray(2) + 1
tmpArray(3) = 0
tmpArray(4) = 0
tmpRange.Value = tmpArray(1) & "." & tmpArray(2) & " - " & tmpRange.Value
Case 3
tmpArray(3) = tmpArray(3) + 1
tmpArray(4) = 0
tmpRange.Value = tmpArray(1) & "." & tmpArray(2) & "." & tmpArray(3) & " - " & tmpRange.Value
Case 4
tmpArray(4) = tmpArray(4) + 1
tmpRange.Value = tmpArray(1) & "." & tmpArray(2) & "." & tmpArray(3) & "." & tmpArray(4) & " - " & tmpRange.Value
End Select
Next x
End Sub
Basically I have the following:
2 columns, column-A contains Name and column-B contains Date
I need to copy the data from column 1 and place it at the end of the content in column 1 for the same ( eg A1 to A10 contains different names) without deleting original content.
I need to copy the data from column 2 and place it at the end of the content in column 2 for the same( eg B1 to B10 contains Same date and " 12-sep " for 10 different names) But here it should change to next day ( B11 to B20 another date "13-sep" )
Give this a try:
Sub dural()
For I = 1 To 110 Step 10
Range("A" & I & ":B" & I + 9).Copy Range("A" & I + 10)
Range("B" & I + 10 & ":B" & I + 19).Value = Range("B" & I + 10).Value + 1
Next I
End Sub