I have a column in a sheet,
I want to change the value of the cell of another sheet with rules:
If the text is: "Won" or "Lost" or "Cancel" Then get these text values into the target cell.
Else values then get the value of right above the From cell.
My syntax like this:
=if('Weekly Plan'!F5 = "Won" or 'Weekly Plan'!F5 = "Lost" or 'Weekly Plan'!F5 = "Cancel";'Weekly Plan'!F5;'Weekly Plan'!F4)
But it has given me the error:
Error
Formula parses error.
Invalid:
Input must fall within the specified range
I don't know how to fix this
Thanks!
Maybe something like that?
=IF(OR(F5="Won",F5="Lost",F5="Cancel"),F5,F4)
You seem not to understand the way logical operators work in Excel formulas:
It's not: A OR B OR C
But: OR(A;B;C)
Or (in case you might need and AND-operator):
It's not: A AND B AND C
But: AND(A;B;C)
Keep out: the semicolon can be replaced by a comma, this is determined by your locale.
Good luck
I am trying to create a pricing spreadsheet for the company I work for.
I am looking for a formula that returns a value from a specific cell based on text in two other cells.
An example is:
Sheet1:A1="Clear", Sheet1:B1="Black"
Sheet2:A1="Opacity", A2="Clear", A3="Yellow"
Sheet2:B1="Color", B2="Brown", B3="Black"
Sheet2:C1="Price", C2:1, C3:4
Return
IF Sheet1:A1="Clear" AND Sheet1:B1="Black", RETURN specific value from Sheet2:C column
Any tips or references I can look at to get this figured out?
I think below will help you to reach to the desired answer.
Add a new A column in sheet 2 (Later you can hide this)
sheet2:A1 -> =CONCATENATE(B2,",",C2) Drag to the End of the table.
sheet1:D1 -> =CONCATENATE(A1,",",B1) (Later you can hide this)
sheet1:C1 -> =VLOOKUP(D1,Sheet2!$A:$D,4,0) (What you expected)
Have you tried simple vlookup with the values ? Something like:
Vlookup ((sheet1$colA & sheet1colB), sheet2$colC, 1,0)
Try this. Will test for more and update.
i have two sheets raw Data and Summary. i need help in editing below formula which i am using in my VBA code. i am looking for sum of one particular id for multiple conditions. in summary unique ids and i already have this formula which is working fine
=SUMPRODUCT(('Raw Data'!$A$2:$A$3457=A2)*('Raw Data'!$D$2:$D$3457={"HAUD","AANZ","CSHK","HCNY","CHN1,CHN2","IN1","DBIN","CSJL","CTOK","BTK","K01","MYFM","MYPB","HNZD","BNZD","PKDB","HSBP","SCS","SCTW","SCT","SCT"})*('Raw Data'!$F$2:$F$3457="BLF")*('Raw Data'!$G$2:$G$3457))
sum in "G" column sholud also include cells in D column which begins with "TW" or "K"
i tried this but its not working
=SUMPRODUCT(('Raw Data'!$A$2:$A$3457=A2)*(LEFT('Raw Data'!$D$2:$D$3457,2)="TW"))*(LEFT('Raw Data'!$D$2:$D$3457,2)="K"))*('Raw Data'!$D$2:$D$3457={"HAUD","AANZ","CSHK","HCNY","CHN1, CHN2","IN1","DBIN","CSJL","CTOK","BTK","K01","MYFM","MYPB","HNZD","BNZD","PKDB","HSBP","SCS","SCTW","SCT","SCT"})*('Raw Data'!$F$2:$F$3457="BLF")*('Raw Data'!$G$2:$G$3457)
your assistance highly appreciated
below one is also tried it shows blank all "," are replaced with * still shows Blank
=SUMPRODUCT('Raw Data'!$G$2:$G$3457,--('Raw Data'!$A$2:$A$3457=A2),(LEFT('Raw Data'!$D$2:$D$3457,2)="TW")+(LEFT('Raw Data'!$D$2:$D$3457,1)="K"),--ISNUMBER(MATCH('Raw Data'!$D$2:$D$3457,{"HAUD","AANZ","CSHK","HCNY","CHN1","CHN2","IN1","DBIN","CSJL","CTOK","BTK","K01","MYFM","MYPB","HNZD","BNZD","PKDB","HSBP","SCS","SCTW","SCT","SCT"},0)),--('Raw Data'!$F$2:$F$3457="BLF"))
I believe that the first formula should be more like:
=SUMPRODUCT(('Raw Data'!$A$2:$A$3457=A2)*('Raw Data'!$D$2:$D$3457={"HAUD","AANZ","CSHK","HCNY","CHN1","CHN2","IN1","DBIN","CSJL","CTOK","BTK","K01","MYFM","MYPB","HNZD","BNZD","PKDB","HSBP","SCS","SCTW","SCT","SCT"})*('Raw Data'!$F$2:$F$3457="BLF")*('Raw Data'!$G$2:$G$3457)*((LEFT('Raw Data'!$D$2:$D$3457,2)="TW")+(LEFT('Raw Data'!$D$2:$D$3457,1)="K")))
There was no quotes in "CHN1,CHN2" in both the first and the working formula that I added. I also changed
(LEFT('Raw Data'!$D$2:$D$3457,2)="TW"))*(LEFT('Raw Data'!$D$2:$D$3457,2)="K"))
to
((LEFT('Raw Data'!$D$2:$D$3457,2)="TW")+(LEFT('Raw Data'!$D$2:$D$3457,1)="K"))
The last one should work if you change the , in the array to ; (to mean a vertical array):
=SUMPRODUCT('Raw Data'!$G$2:$G$3457,--('Raw Data'!$A$2:$A$3457=A2),(LEFT('Raw Data'!$D$2:$D$3457,2)="TW")+(LEFT('Raw Data'!$D$2:$D$3457,1)="K"),--ISNUMBER(MATCH('Raw Data'!$D$2:$D$3457,{"HAUD";"AANZ";"CSHK";"HCNY";"CHN1";"CHN2";"IN1";"DBIN";"CSJL";"CTOK";"BTK";"K01";"MYFM";"MYPB";"HNZD";"BNZD";"PKDB";"HSBP";"SCS";"SCTW";"SCT";"SCT"},0)),--('Raw Data'!$F$2:$F$3457="BLF"))
I am trying to do relative referencing for a specific column (in Sheet "OA") where I need to retrieve the content of cells in a new sheet in steps of 110
e.g,
=OA!$AB217
=OA!$AB327
=OA!$AB437
Rather than manually code the formula in each cell, trying to drag the cells so the address could be dynamically generated.
On the above example, when I drag the cell, I am unable to get
=OA!$AB547
but getting
=OA!$AB220
I also tried to code it this way, "=OA!$AB($107+(n*$110))" where when the n values naturally incremented during the drag, I will get the right formula.
E.g
=OA!$AB($107+(1*$110)) => =OA!$AB217
=OA!$AB($107+(2*$110)) => =OA!$AB327
=OA!$AB($107+(3*$110)) => =OA!$AB437
=OA!$AB($107+(4*$110)) => =OA!$AB547
Unfortunately the format is not accepted by excel.
Could you please give me a hint what mistake I could have made ? My search on the internet have not been fruitful.
rgds
Saravanan K
You're looking for the "Indirect" function. Assemble a text string with the address of the cell you want, and call =indirect("string"). You can use the "&" operator to combine static strings with variables.
I've created a workbook with Sheet1 and OA
OA!A1:A1000 contain the numbers.
Sheet1!C1 contains 1
Sheet1!C2 contains 100
Sheet1!B1 contains =INDIRECT("OA!$A"&C1)
Sheet1!B2 contains =INDIRECT("OA!$A"&C2)
I'm not sure if this is even possible without going to VB, but I was trying to do it through conditional formatting. Basically I have a column (Column K) that will always be the same value (345) if there is a record entered in that row. Basically when I populate my reports I simply want the value (345) to be entered into Column K if there is any data in that row. I was trying to just use Column A as a reference. I was messing with =IF(ISTEXT(Col.A location),"345","") but that's getting nowhere. So, I'm looking for ideas outside of vba, but if there are no possibilities then vba is the way to go I suppose. :)
Assuming your data is in columns A to J, and that it starts in row 2, enter this in K2 and copy down as necessary:
=IF(COUNTA(A2:J2),345,"")
Edit: For a conditional formatting formula you don't need the "If" part, because the formatting is already ... conditional:
=COUNTA(A2:J2)
Will this work?
=IF(ISBLANK(A1),"","345")
This code works to tell whether column A has something in it or not COUNTA(INDIRECT("$A$"&ROW()))>0, but I don't think you can set the value of the cell using conditional formatting. But with conditional formatting you have to know ahead of time how far down your data is going to go unless you just put it in all the rows.
Why don't you just put it in your VBA code when you are copying, you can find out what the last row is then put the IF() formula in. You can use this code:
Dim r1 As Range
Set r1 = Range("K1")
r1.NumberFormat = "General"
r1 = "=IF(COUNTA(INDIRECT(""$A$""&ROW())>0,""345"","""")"
r1.AutoFill Destination:=Range(r1, r1.Offset(200))