I hope you can help me on this issue.
I am currently using Excel 2007 and I am creating a dynamic Planning/Time Sheet for our Team.
So far everything is going well.
Now unfortunately I am having an issue with the Conditional Format.
I am formatting the Cells in order to graphically show the current Status of the Person working. I am using the Conditional Format with a Formula example: =OFFSET(DataStart17D;COLUMN();ROW()-49;1;1)="PM"
Now I am trying to applying 2 conditions with a gradient fill of 2 colors like example: =AND(IF(OFFSET(DataStart17D;COLUMN();ROW()-49;1;1)="PM";TRUE;FALSE);IF(OFFSET(DataStart17D;COLUMN();ROW()-52;1;1)="AM";TRUE;FALSE)
Problem is, as soon as I use the IF or the AND Statement no condition is applied at all.
I have applied the above formula to the Cell itself and have received "TRUE" as the condition.
What is odd too is that if I apply =OFFSET(DataStart17D;COLUMN();ROW()-49;1;1)="PM" it works fine, if I use =IF(OFFSET(DataStart17D;COLUMN();ROW()-49;1;1)="PM";TRUE;FALSE) once again no condition applies.
I have searched the web for a Solution and could not find one yet :(
Would really be pleased if someone could help me on this one :)
Best Regards,
Richard J. Dana
You don't need IF Statment and TRUEs and FALSEs withih a Conditional Formatting formula. By its nature the formula is conditional.
Try something like:
=AND(OFFSET(DataStart17D;COLUMN();ROW()-49;1;1)="PM";OFFSET(DataStart17D;COLUMN();ROW()-49;1;1)="AM")
Once you do so, you'll see an additional problem. The two statements in your AND function are mutually exclusive, so it will never evaluate to TRUE.
EDIT:
There does seem to be an issue with the AND statement and multiple OFFSET statements that use ROW or COLUMN
Please note that I'm going to use commas instead of semicolons as function parameter separators here, otherwise it's too hard to convert. You'll have to change the commas back to semicolons.
Also note that you didn't need the last two arguments in either the ROW or COLUMN function in your original question. You had them set to a height and width of 1, which is the default, and is optional.
Here's a simplified example:
If you do something like:
OFFSET(DataStart17D,ROW()+1,COLUMNS())="PM"
it will evaluate to TRUE in the worksheet and also in the conditional formatting
If you do something like:
=AND(OFFSET(DataStart17D,ROW()+1,COLUMNS())="PM",OFFSET(DataStart17D,ROW()+1,COLUMNS())="PM")
which is just repeating the same statement twice, it will evaluate to TRUE in the worksheet, but won't trigger the conditional format.
All of the above is just as you stated in your question. The answer that I think works is to use ROWS and COLUMNS instead, like this:
=AND(OFFSET(DataStart17D,ROWS($1:2)+1,COLUMNS($A:A))="PM",OFFSET(DataStart17D,ROWS($1:2)+1,COLUMNS($A:A))="AM")
The above would be the formula for A2. Note that the first row or column inside the parentheses is anchored with a dollar sign. This gives you the count of rows or columns from A1, effectively the same thing as the ROW or COLUMN function.
Related
I am adding a formula to a worksheet via VBA which should be:
=UNIQUE(IF(TableA[ColumnA]=A1,TableA[ColumnB],""))
This utilises the new SPILL feature in Excel to give me a list of column B values where the related value in column A matches what is in cell A. I'm also applying the UNIQUE function to remove any multiple blank ("") results.
This works perfectly if I manually type the formula into Excel, however in using VBA to add the formula, Excel is adding # symbols within the formula, and causing it to show #VALUE!.
The VBA line being used to add the formula is:
=Cells(x,y).Formula = "=UNIQUE(IF(TableA[ColumnA]=A1,TableA[ColumnB],""""))"
The resulting output in Excel is:
=#UNIQUE(IF(TableA[#[ColumnA]]=A1,TableA[ColumnB],""))
What is going on, and what have I missed?
Thanks in advance!
Good question, and I looked it up...
In short:
Use =Cells(x,y).Formula2 instead of =Cells(x,y).Formula
Explaination:
The # that shows is called the implicit intersection operator. From MS docs:
Implicit intersection logic reduces many values to a single value. Excel did this to force a formula to return a single value, since a
cell could only contain a single value. If your formula was returning
a single value, then implicit intersection did nothing (even though it
was technically being done in the background).
But why does it appear in your newer Excel O365? Well, Range.Formula uses IIE (implicit intersection) thus adding the # to basically undo your dynamic array functionality. UNIQUE is a new dynamic array function. So, to write this out in code, you should use the Range.Formula2 property (or Range.Formula2R1C1 if you use R1C1 notation). These properties use AE (array evaluation) and is now the default.
Here is an informative doc from MS on the subject which explains the difference between Formula and Formula2 in more detail.
If you want to know more about the implicit intersection operator then have a look at this
I answered another question earlier on that involved implicit intersection with an example on how that actually works here if one finds it interesting.
I'm not using SQL at this point, I'm just trying to define a function using query design function in MS Access 2010.
What i'm trying to do:
So turns out that I have a 5 month spread (Jan,Feb..May) where each month is a column. Turns out that at times May has a value and January does not, but it should. All the values are either one or null.
What I'm trying to do is write an if function of this sort:
Jan15new: Iff([May-15]=1,[Jan-15]=1,[Jan-15])
However, when I run the query with this iff function I got a column full of negative ones that doesn't abide by the rules of this if function.
If you can shed somelight that would be great!
thanks,
This formula returns a 1 if May-15 = 1, otherwise returns whatever value is in Jan-15:
Jan15new: IIf([May-15]=1,1,[Jan-15])
If the values in your formula are Boolean values, you do not need to compare them to anything, and you should not be comparing them to numbers:
Jan15new: IIf([May-15]=True,[Jan-15]=True,[Jan-15])
That's actually meaningless, because it is equivalent to this:
Jan15new: IIf([May-15],[Jan-15],[Jan-15])
I've been trying for a while to create a (little bit complicated?) cell calculation where I need to use a dynamic formula but is not working. At the end I'm obtaining the mdx expression as the cell value, which is wrong. Here is my expression:
-----------------------------------------------------------------------
---SET With 2 elements(Sales Fcst(20131223), Sales Fcst(2014))
WITH SET [CategoryFcst] AS
FILTER([Category].[Category].children, InStr([Category].[Category].CURRENTMEMBER.MEMBER_CAPTION,"Sales Fcst") > 0 )
CELL CALCULATION SalesPlanAch FOR
'([Category].[Category].[Sales Plan Att%], [Measures].[Amount])'
AS
'(StrToMember("' + [CategoryFcst].item(0).UNIQUENAME + '"),[Measures].[Amount] )'
--The formula expression result is: (StrToMember("[Category].[Category].&[29]"),[Measures].[Amount] )
SELECT [Time].[Calendar Time].[Quarter].members on columns,
[Category].[Category].children on rows
from [AllData]
WHERE ([Measures].[Amount])
-----------------------------------------------------------------------
If I put directly '(StrToMember("[Category].[Category].&[29]"),[Measures].[Amount])' as the cell calculation formula it will work, but I need to calculate that dynamically.
Also, if I put '(StrToMember("' + '[Category].[Category].&[29]' + '"),[Measures].[Amount] )' doesn't work. It sets that string as the cell value.
That is not the real cell calculation but the part that is causing me problems.
I'd appreciate any advice/answers.
Best regards,
Daniel
Just use
'(StrToMember([CategoryFcst].item(0).UNIQUENAME),[Measures].[Amount] )'
As far as I understand, the necessity of quotes around this expression is due to the history of Analysis Services as described here. And, as described in the same article, in version 2005 of Analysis Services, this was changed for member and set definitions in the WITH clause, but apparently not for the rarely used cell calculations. Hence, the quotes here are not something that encloses a string, but more or less a syntax requirement to enclose the expression.
I am actually not sure how you would use single quotes within this expression. But you can use double or single quotes in MDX expressions to enclose strings. Thus you will rarely come across the necessity to absolutely need single quotes in this type of expressions.
I have a table with a package size column with a data type of text that I need to convert to an integer for mathmatical reasons. The values in this column typically look something like "100ML","20GM","UD 20","13OZ" here is where it gets tricky there are occasionally values like "6X12ML","UD 5X6ML". The ones with the "X" in them I need to remove the "ML" I'm currently doing this with
Replace([TABLE_NAME].[COLUMN_NAME],"ML","")
in an expression column in a query. I can use nested Replace functions to remove the "ML","GM","OZ" and "UD ". All of my attempts to do this have failed, I figured the end solution would be something like
IIf([TABLE_NAME].[COLUMN_NAME] Like "X", (CInt(Left([TABLE_NAME].[COLUMN_NAME],InStr(1,[TABLE_NAME].[COLUMN_NAME],"X")-1))*CInt(Right([TABLE_NAME].[COLUMN_NAME],InStr(1,[TABLE_NAME].[COLUMN_NAME],"X")+1))),[TABLE_NAME].[COLUMN_NAME])
I have tried using a variation of the code above with no avail. All suggestions are appreciated, I would preffer to get this knocked out in one query but I do realize I can use and expression and just split the text before and after the "X" into two differenct expression columns. Then use another query to multiply the values.
QTY_ORDERED: IIf(InStr(1,Replace(Replace(Replace(Replace([STANDARD_PRICING].[PACKAGE_AMOUNT],"GM",""),"ML",""),"UD","")," ",""),"X")>1,[CRX_HISTORIC_PO].[QUANTITY]/Left(Replace(Replace(Replace(Replace([STANDARD_PRICING].[PACKAGE_AMOUNT],"GM",""),"ML",""),"UD","")," ",""),InStr(1,Replace(Replace(Replace(Replace([STANDARD_PRICING].[PACKAGE_AMOUNT],"GM",""),"ML",""),"UD","")," ",""),"X")-1)*Right(Replace(Replace(Replace(Replace([STANDARD_PRICING].[PACKAGE_AMOUNT],"GM",""),"ML",""),"UD","")," ",""),Len(Replace(Replace(Replace(Replace([STANDARD_PRICING].[PACKAGE_AMOUNT],"GM",""),"ML",""),"UD","")," ",""))-InStr(1,Replace(Replace(Replace(Replace([STANDARD_PRICING].[PACKAGE_AMOUNT],"GM",""),"ML",""),"UD","")," ",""),"X"))*-1,[CRX_HISTORIC_PO].[QUANTITY]/Replace(Replace(Replace(Replace([STANDARD_PRICING].[PACKAGE_AMOUNT],"GM",""),"ML",""),"UD","")," ","")*-1)
The code above is what I used to complete the task at hand.
I have a cell that contains an array of characters seperated by commas i.e. "1,2,3,4,5" My question is, is it possible to remove a particular element of the array such as if I wanted to remove "1" then the cell would then become "2,3,4,5" or remove "3" and it becomes "1,2,4,5" I want to perform this task within SQL either as a function or a stored procedure, any help is much appreciated.
Sure, it'd just be some basic string REPLACE() calls: http://msdn.microsoft.com/en-us/library/ms186862.aspx
However, since you have to manipulate individual bits of this data field separately from the rest of the field, it's a good candidate for getting normalized into its own child table.