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.
Related
So this is what I want to do:
For example, in the sheet named "Outputs", the A1 cell input is
= "abcd" & Input!A5 & "efgh",
where Input!A5 is the cell value of the different sheet in the excel file.
I want to make it change so that after executing all the methods after selecting the A1 cell as
= "abcd" & Input!A5 & "efgh", I want to change the A1 cell as, = "abcd" & Input!A6 & "efgh", and then = "abcd" & Input!A7 & "efgh" and so on. (So it's basically replacing the values as A1 to Ai)
I thought of using Replace function, by writing the replacing string as Ai, and replacing i with i +1 by starting with for loop.
But I don't think this is a right method.
Could anyone shed light on how to address this?
Thanks in advance.
Check this
InputWorksheetLastRow = 7 'place here your last row value
Set ws = Worksheets("Input")
For i = 5 To InputWorksheetLastRow
Worksheets("Outputs").Range("A" & i - 4).Formula = "=" & Chr(34) & "abcd" & Chr(34) & "&Input!" & ws.Cells(i, 1).Address(0, 0) & "&" & Chr(34) & "efgh" & Chr(34)
Next i
I have a set of data and i have a macro running adding a line each 5 seconds
This is linked to a pivot-table and a pivot-chart in a Dashboard
Looks like this (picture is my 2nd version with incremental instead of decremented)
I have a field in a hidden page where i put how many of the last logged line i want to see
For example i have 1000 lines and i want the dashboard graph, to the press of a button, toggle between "see only last X" or "see all"
I want to find a lighter way to do what i have done cause i see a big latency
I have achieved this by adding two columns in my data with a macro writing formula in them in a way that
Col D : give a value to the line
Col E : if the value of D > 0 write "last X logs" and the rest "before X logs"
I put this code for Col D
Settings!I4 = Field where i but the amount of logs i want Ex; 15
Settings!I5 = Is where i store the last row value to be used in the formula thus updating all the line at each added lines
setsheet.Range("I5").Value = lastrow
logsheet.Range("D" & lastfreerow).Value = ("=Settings!I4-(Settings!I5)") & "+" & setsheet.Range("I5").Text
This write the formula in the cell and look like this :
=Settings!I4-(Settings!I5)+7
the result is a count down where the most resent value is "15"
and the oldest goes in the negative
And put this code for Col E
logsheet.Range("E" & lastfreerow).Value = "=IF(RC[-1]>0,""Last"" & "" "" & Settings!R4C[4] & "" logs"",""Before the last"" & "" "" & Settings!R4C[4] & "" logs"")"
This write the formula in the cell and look like this :
=IF(D8>0;"Last" & " " & Settings!I$4 & " logs";"Before the last" & " " & Settings!I$4 & " logs")
And i use those those "values" in the slicer that sort my pivot-table
thank you
This is my version a bit simplified since there is only one column with a updating formula at each cycle. But i didnt see much improvement on the load of the macro
Before
'Create the IF formula that will give a value to the row, the older the row the smaller the value
setsheet.Range("I5").Value = lastrow
logsheet.Range("D" & lastfreerow).Value = ("=Settings!I4-(Settings!I5)") & "+" & setsheet.Range("I5").Text
'Create the IF formula that will say if the row is part of the desired range for the "last logs" option
logsheet.Range("E" & lastfreerow).Value = "=IF(RC[-1]>0,""Last"" & "" "" & Settings!R4C[4] & "" logs"",""Before the last"" & "" "" & Settings!R4C[4] & "" logs"")"
After
'Log#; simply give an incremental value to each row starting from 1
setsheet.Range("I6").Value = lastrow - 6 'Row value of the last log, put into the hidden setting page to be used in a formula
logsheet.Range("D" & lastfreerow).Value = (lastrow - 6) 'Row value of the last log,
'Create the IF formula that will say if the row is part of the desired range for the "last logs" option
logsheet.Range("E" & lastfreerow).Value = "=IF((Settings!R6C9 - Settings!R4C9) < (Log!RC[-1]),""Last"" & "" "" & Settings!R4C9 & "" logs"",""Before the last"" & "" "" & Settings!R4C9 & "" logs"")"
If you have any idea of a way to sort a Table in a way that the Chart show only the last X values im interested
Thank you for your time!
This is what I am needing to put into Column A
= B1 & " " & C1 & " " & D1 & " " & E1 & " " & F1 & " " & G1 & " " & H1 & " " & I1
wherein the numbers will correspond to the current row that it is pasted in. Is there a faster way than simply pasting it in and manually changing the 1's to 2's, or to 3's or to 37892's?
You would string together a bunch of formulas:
=INDEX(B:B,Row()) & " " & INDEX(C:C,Row()) & ...
But if all you want is to put the formula in J1 and copy it down, then use your original formula. Put it in J1. then do one of the following:
Click on the lower right corner and drag down as far as you want.
Highlight J1 and all the cells below in which you want the formula. Go to Fill --> Down
Either of these will automatically change the row number on your original formula.
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'm using VBA to introduce formulas in my local database regarding some conditions. Here is an example of the code I'm using:
Range("CP" & l).Formula = "=IFERROR(((T" & l & "*6)-SUM(U" & l & ":Z" & l & "))/(T" & l & "*6);"""")"
Were "l" is my first blank row (it's working)
The formula is working very well, but the problem I have is that the code is returning only the value of the result in my cell, but I would like to see the whole formula in my cell.
Is it something that can be possible to do ?
* The real problem is that the formula IS NOT in the formula bar. The Code write the score, but not the formula. If I do a test with
Range("CP" & l).Formula = "=((T" & l & "*6)-SUM(U" & l & ":Z" & l & "))/(T" & l & "*6)"
I see the formula in the formula bar.
I really don't understand...
Thanks :)
Marie
but I would like to see the whole formula in my cell.
To display the formula in the cell instead of the values, you have 3 options
Format the cells as text and then use the code which you have.
Range("CP" & l).Formula = "=IFERROR(((T" & l & "*6)-SUM(U" & l & ":Z" & l & "))/(T" & l & "*6);"""")"
Change .Formula to .Value and add a ' before the = sign
Range("CP" & l).Value = "'=IFERROR(((T" & l & "*6)-SUM(U" & l & ":Z" & l & "))/(T" & l & "*6);"""")"
Activate the option File Tab | Options | Advanced | "Show Formulas in cells instead...."