Can't count cells populated by a RegExMatch function - regex

I am attempting to count the sum of a column populated by a RegExMatch function but using a COUNT function, eg =COUNT(F2:F100).
The function that populates a cell with '1' is:
=IF(RegExMatch($E2,"SKU123"),"1","")
I can see '1' appear many times in the column but when I attempt to sum the column I get a zero answer.
Any suggestions for how I perform a better RegExMatch (or alternative) or way to sum the column?

Change your formula from
=IF(RegExMatch($E2,"SKU123"),"1","")
to
=IF(RegExMatch($E2,"SKU123"),1,"")
and will work.
COUNT returns the number of numeric values in a dataset, and you were filling with strings. SO in your version it will always return 0.

Related

Highlight row with highest cell value within dynamic range

I want to highlight the cells in a Google Spreadsheet with the highest values based on a dynamic range.
I've got two columns: column K and column L. Column K contains sums of data, column L contains either 'Yes', 'No' or 'Maybe'.
I want to use conditional formatting to highlight the rows with the highest value in column K AND which contain 'Yes' in column L (so, the highest value in column K is only calculated from the rows that contain 'yes' in column L as well). It is possible that there's multiple highest values that have 'Yes'. So while the absolute highest value in the whole of column K can be found on (for example) K100, and the second-highest is found on K59, if L100 doesn't include 'Yes' on column L but L59 does, row 59 will be highlighted.
I've got this code for highlighting whenever L is equal to 'Yes':
=$L:$L = "Yes"
And this code for highlighting the highest value in column K:
=$K5=MAX($K$5:$K$999)
But I have to combine them somehow.
I think that some kind of IF- or AND-statement will be the solution, but I don't know how to dynamically call on the range I need. The position of the Yes'es change based on other values and are not necessarily below each other. For instance:
=IF($L:$L="Yes";MAX($K1;$K3;$K4;$K9))
Where '$K1;$K3;$K4;$K9' represents the dynamic range.
try like this for range A5:Z:
=($L5="Yes")*($K5=MAX($K$5:$K))

Comparing numbers in Calculated Column formula, inside a simple OR Condition then IF Condition is not returning Correct Value in SharePoint

Simply trying to compare numbers in formula for calculated Column Total Days in Route. The numbers to be compared are returned by subtraction like TODAY()-[CurrentRouteDateTemp] where the column CurrentRouteDateTemp is of type Date
See column descr
Why is it still just returning the value from the main calculation i.e. TODAY()-[CurrentRouteDateTemp] Why the rest of the condition not working????
See list view
Try to add value function in the formula, like this:
or(value(TODAY()-[CurrentRouteDateTemp])=43725,value(TODAY()-[CurrentRouteDateTemp])<0)

Checking if any value in Column is equal to Todays Date

I'm working in Google Sheets and I am trying to determine if any value of dates listed in the column is equal to Today's Date.
I have tried using the COUNTIF formula the ISDATE formula and the IF formula against the value of TODAY() and nothing seems to be working right.
=IF('Invoices-Quickbooks-Data'!L:L,ISDATE(TODAY()),true)
This formula actually works the best for me. I would expect it to calculate if any of the values equal Today's Date. Ironically this tells me that the answer is TRUE even when none of the dates actually match Today's date so I am not sure what is going on.
First, the reason why your formula is always returning true is because ISDATE(TODAY()) will always return true (when is today not a date?) and furthermore, you can't use an IF statement like that to query a whole column. The first argument to IF is a condition, and a column range is not a condition.
To apply a function over a range, you want to use an ARRAYFORMULA. Here is how you would check a range of cells to see if any value in the column (or range) contains a date equal to today:
=IFERROR(VLOOKUP(TRUE,ARRAYFORMULA(IFERROR(DATEVALUE(A:A)=TODAY(),FALSE)),1,FALSE),FALSE)
Just replace A:A with the range you want to check. The return of an ArrayFormula is an array, which is why I have to use VLOOKUP to check for any TRUE values inside it.
Advanced solution:
A really cool feature in sheets is the query() function, which essentially lets you run a SQL-like query over a range of cells. I like it because it makes formulaes very readable - for example, the entire ARRAYFORMULA solution above can be replaced with:
=IFERROR(QUERY('Invoices-Quickbooks-Data'!L:L,"select count(L) where dateDiff(L,now()) = 0 label count(L) ''",-1) > 0,FALSE)
you can check it with just simple IF formula:
=ARRAYFORMULA(IF(LEN(A2:A), IF(A2:A=TODAY(), TRUE), ))
=ARRAYFORMULA(IF(A2:A=TODAY(), TRUE, ))

Power BI remove duplicates based on max value

I have 2 column; ID CODE, value
Remove duplicates function will remove the examples with the higher value and leave the lower one. Is there any way to remove the lower ones? The result I expected was like this.
I've tried Buffer Table function before but it doesn't work. Seems like Buffer Table just works with date-related data (newest-latest).
You could use SUMMARIZE which can be used similar to a SQL query that takes a MIN value for a column, grouped by some other column.
In the example below, MIN([value]) is taken, given a new column name "MinValue", which is grouped by IDCode. This should return the min value for each IDCode.
NewCalculatedTable =
SUMMARIZE(yourTablename, yourTablename[IDCode], "MinValue", MIN(yourTablename[value]) )
Alternatively, if you want the higher values just replace the MIN function with MAX.

Sum values in one column of all rows which match one or more of multiple criteria

I have some table data in which I'd like to sum all the values in a specific column of all rows where column A contains string A and/or column B contains string B. How can I achieve this?
This works for one criterium:
=SUM(FILTER(G:G,REGEXMATCH(F:F,"stringA")))
I tried this, but it didn't work:
=SUM(FILTER(G:G,OR(ISTEXT(REGEXMATCH(F:F,"stringA")),ISTEXT(REGEXMATCH(C:C,"stringB")))))
Please try:
=SUM(FILTER(G:G,REGEXMATCH(F:F,"stringA")+REGEXMATCH(C:C,"stringB")))
+ works for or logic. ISTEXT is not needed because REGEXMATCH gives true or false.
OR does not work because filter is an arrayformula, use + in array formulas.
=SUM(FILTER(G:G,REGEXMATCH(F:F&C:C,"stringA|stringB")))
OR is denoted by |
EDIT Added &C:C to denote different Columns