I have the following function
=IF([A68U.SI.csv]A68U.SI!$G$3:$G$1000="","",[A68U.SI.csv]A68U.SI!$G$3:$G$1000)
Here, I would like to replace A68U.SI with the entry in cell C1, which contains the text "A68U.SI".
I tried the following formula but am getting an error:
=IF((INDIRECT("[" & C1 & ".csv]" & C1 & "!"))$G$3:$G$1000="","",INDIRECT("[" & C1 & ".csv]" & C1 & "!"))$G$3:$G$1000)
Does anyone have an idea what's wrong?
As always, many thanks!
try
=iferror(IF((INDIRECT("[" & C1 & ".csv]" & C1 & "!"))$G$3:$G$1000="","",INDIRECT("[" & C1 & ".csv]" & C1 & "!"))$G$3:$G$1000),"Please open the file "&C1&".csv")
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
Range("E2").Formula = "=" & column1name & "2" & "" | "" & column2name & "2"
I am trying to make formula in VBA. I want to set E2 =( A2 | B2) . I already used function to convert column A into variable column1name already. So VBA will read it as A. but I am getting error that highlight my "|" and saying
invalid character.
How can I solve this problem?
Range("E2").Formula = "=" & column1name & "2 | " & column2name & "2"
will return
=A2 | B2
// Edit according comments
Range("E2").Formula = "=" & column1name & "2 & ""|"" & " & column2name & "2"
will output
=A2 & "|" & B2
If your intent is to join A2 and B2 cell through formula using PIPE (|) character then you can try below code.
Range("E2").Formula = "=" & column1name & "2&""|""&" & column2name & "2"
Alternative via Join()
In order not to loose a clear view over multiple quotation-mark sequences,
I'd suggest to separate into tinier parts as follows:
Const PIPE As String = """|""" ' pipe character with quotation-marks
Sheet1.Range("E2").Formula = _
"=" & Join(Array(column1name & "2", PIPE, column2name & "2"), "&")
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") & ")"
How to return formula of other cell (column L) if choose item in column A.
Example:
if answer, then return =I5 & " " & J5
if foo, then return '=I7 & " " & J7 & " " & K7 & " x " & L7
I want to return the formula instead of the result.
Put this function in a public module
Function GetFormula(rng As Range) As Variant
GetFormula = rng.Formula
End Function
I think this is what you want. There are several options for how you want that formula returned such as R1C1 style.
Edit
Oh I think I get what you want more. Ok to apply the formula you have in your blue table to whatever cell you want in column F you can call the Indirect function.
So for example if you want to apply the formula '=I7 & " " & J7 & " " & K7 & " x " & L7 to your column F then call =INDIRECT(I7 & " " & J7 & " " & K7 & " x " & L7). In your column I don't include the = sign. it will make it a bit easier.
You can use Vlookup to find where this should be applied by using your lookup item in column A in your reference table (the blue table). Return the formula in column I.
You can achieve this by nesting your formulas.
put this in E5
=IF(A5 = "answer", A5 & " " & B5 & " " & D5,
IF(A5 = "bar", A5 & " " & B5 & " " & C5,
IF(A5 = "foo", A5 & " " & B5,
"No If Formula Here yet")))
I started the formula off with the first two formatting's for you.