Conditional formatting - multidimensional-array

Conditional formatting based off formulas and cells value.
My task is to highlight cells in a data set that do not have a formula. The first part is simple, as I used the (and) function and the (isformula) function. Please see my formula below.
=(AND(ISFORMULA($V72),ISFORMULA($W72)
Basically if the cell contained a formula we get a true response. All of the pieces of the (and) function must be true for the statement to be true.
I added the IF statement, so my formula could be changed to have the end result of True when really False and False when really true.
Conditional formatting will highlight the cells in referenced row that Basically if my (IsFormula) function was false I need it to become true to apply my formats. IF statement if true will have text as "False" and if the logical test is false the false response will be text as "True".
=IF(AND(ISFORMULA($V3),ISFORMULA($W3),ISFORMULA($X3)),"False","True")
Everything that I mentioned above works fine. I need to only apply the conditional formatting if the cells do not have formulas and the cell value is greater than zero. Please help me to figure this out.
I tried this
=AND(ISFORMULA($V5),ISFORMULA($W5),ISFORMULA($X5),($V5 >0),$W5>0)
and
IF(AND(ISFORMULA($V5),ISFORMULA($W5),ISFORMULA($X5),($V5 >0),$W5>0),"False","True")
Even though the cell has a value of zero it is still being formatted.
Please help.

You can apply the following formula, starting in V5 -or wherever your data block actually begins -then highlight the entire data range and typing within the conditional formatting box: =AND(ISFORMULA(V5) =FALSE,V5>0). This answer is based on whether I understood your explanation correctly.

Related

Has the behavior of `drop = FALSE` been changed in R version 4 without the documentation making note of that?

Forgetting to add drop = FALSE where you need it is one of the classic R frustrations. This issue is so well-known that the Tibble package has its replacement for data frames always pass drop = FALSE (example). Everything that I remember about R tells me for absolutely certain that data frames respect drop = FALSE. However, if I look at the documentation for [ (Extract {base}), I find that it says:
drop For matrices and arrays.
Notably, this does not mention data frames. Does this suggest that drop has been changed recently? My intuition, supported by the hyperlinked example about tibbles, insists that data frames respect the drop argument, but I can no longer find any documentation to support that.
[ is a generic function. You wanted the documentation for [.data.frame (Extract.data.frame {base}).
drop logical. If TRUE the result is coerced to the lowest possible dimension. The default is to drop if only one column is left, but not to drop if only one row is left.

Order of arguments and Table function output in R

I have a silly question. Below is the output of a logistic regression analysis I did. I notice that when I switch the order of the arguments I put in the table function in R that it also switch the false positives and the false negatives values but it did not switch the the location of the Female and Male rows and columns. This to me seems like it could really affect the interpretation if the false positives/negatives can change just from the order the arguments are put into the table. I need to know which order output is correct and the proper order for placing arguments in the table function

R: Checking variable types

I'm quite new to R, and I am currently trying to write a code with some foolproofing.
For example, I have a function where let's say it takes (n,c,l)
where the variables are supposed to be numerical, character, and logical types.
Is there a way so that I can check these things?
for example, I've tried is.integer(3) ... this returns FALSE.
Ideally, what I'm looking for is for example, suppose abc() is some function that will test if l==T or l==F (checking if the proper logical is input.
then: abc(T) gives TRUE, and abc(2) gives FALSE.
Also is there a way to check if n is specifically an integer? I mean I could check if (n%%1==0), but is there a specific function for this?
Thank you kindly in advance for what may seem to be a very basic question.
As suggested in the comments, you can use
is.numeric(3)#check whether numeric
is.integer(3L)#check whether integer
is.logical(TRUE)#Check whether logical
is.logical(2)#will return false
is.character("abc")#check whether character
is.character(4)#will return false
Similarly, you can check for other data types in R. Hope this is of help.

Extract formula from Excel Data Table (What-If Analysis)

I am faced with rewriting an Excel project in R. I see a table in which a cell {= TABLE (F2, C2)} is shown. I understand how to create a Table like this (What-If Analysis, Data Table...).
As I have to understand this to rewrite in R, how can I find the original formula which stands behind that cell?
EXAMPLE: I have created a Data Table as shown here and the sheet looks like this:
In my case, I don't know how the sheet was created, and I want to know the initial formula. Now this is shown as {=TABLE(,C4)}.
(In the example I know the answer, it is in the cell (D10), but where is reference for this cell in Data Table?)
I'm using Excel 2007 but have no reason to believe things differ in other versions.
#Stanislav was right to reject my comment suggestion that TABLE was a name; it is an EXCEL function. But it is a very strange function :-}
There isn't any help on the TABLE function in the local help, it isn't listed in "List of worksheet functions (alphabetical)".
You can't manually enter or edit the TABLE function; error "That function is not valid".
Copy/Pasting cells containing the TABLE function pastes their values, not their formulae, even when you specify Paste Special > Formulas
You can't insert rows/columns immediately above/left of cells containing the TABLE function; error "Cannot change part of a data table".
Pace #pnuts using Formulas > Formula Auditing cells containing the TABLE function shows no precedents and no cells show them as dependents. Although in a VBA sheet auditing tool which I use the Range.DirectDependents Property finds the "formula range" dependent on the "margin" cells containing the formulas, but not those containg the values (see below for explanation of those terms).
I haven't been able to find anything I regard as decent documentation of TABLE(). I have found lots of illustrations of how to produce and use that function, but nothing clearly specifying the arguments and result. The best I've found is https://support.office.com/en-us/article/Calculate-multiple-results-by-using-a-data-table-e95e2487-6ca6-4413-ad12-77542a5ea50b. I'd be pleased if anyone can point me to better documentation.
I deduce the bahaviour as described here:
TABLE(Rowinp,Colinp) is an array formula in a contiguous array of cells. I'll refer to that contiguous array as the "formula range" of the data table.
The cells immediately above/left of the formula range are also part of the data table, even though they do not contain a TABLE() function and can be edited; I'll refer to those cells as the "margins" of the data table.
Rowinp and Colinp must be blank or references to single cells.
Rowinp and Colinp must be different (or error "Input cell reference is not valid"), they must not both be blank.
The values in the formula range are calculated by taking formula(s) from the margin(s) and substituting references to Rowinp and/or Colinp with values from the margin(s).
There are three mutually exclusive possibilities, corresponding to Rowinp blank or not.
TABLE(Rowinp, ) Colinp blank. The formula is that in the left margin of the same row with instances of Rowinp replaced by values from the upper margin of the same column.
TABLE( , Colinp) Rowinp blank. The formula is that in the top margin of the same column with instances of Colinp replaced by values from the the left margin of the same row.
TABLE(Rowinp, Colinp) Neither blank. The formula is that in the cell at the intersection of the left and top margins with instances of Rowinp replaced by values from the upper margin of the same column and instances of Colinp replaced by values from the the left margin of the same row.
I think that should let you work out what the effective formula is in each cell of the formula range.
But I wouldn't be surprised to learn that any of the above is wrong :-0
I welcome pointers to anything more authoritative.
I think in your example the F2 and C2 are effectively only the addresses of parameters for a function (TABLE) where that may be located anywhere, with the associated formula in the table's top left cell.
So I suggest go to C2, FORMULAS > Formula Auditing and click Trace Dependents, repeat for F2 and see where the arrows converge.

VBA remove formula and leave original value

I have a spreadsheet called "MTM Lookup", this is downloaded from a specific site, in column D of this spreadsheet are values, but these values have a formula attached to them. The formula rounds these values to 0. The formulas don't round on a specific cell. They look like this =ROUND(35370.6708773751,0) or =ROUND(48368.0427161566,0). I need the values to come through with all the decimals or rounded to 10 decimals but cannot get this to happen, I can remove the formula and leave the value but it is rounded to zero. Please could anyone assist with some simple vba to either remove the =round(,0) or replace the 0 to 10 ie round(x,10).
I don't see any problem in the formula you provided.
When I put
=ROUND(35370.6708773751,0)
to a cell, I correctly see 35371 in the cell.
There are, however, two things in play here.
Formula
Cell Format
For example, when I enter the following value to the cell:
=ROUND(35370.6708773751,10)
I do see 35370.67088 as a result (after rounding to 10 places, cell format rounds it again to 5 decimal places)
I don't know why entering the value without any formula shows you 0, but this leads me to the same suspscion, i. e. that the problem is in the cell format.
You can check it by right clicking on the cell > Format Cells (in office 2010 at least) or programatically, using the following, for example:
sheets("MTM Lookup").range("A:1").numberformat = "0.0000000000"
Hope that it helps.

Resources