Highlight row when two cells match - row

I have a sheet where on column "F" I enter the number of items purchased and on column "I" the number of items sold.The actual data starts at row 4. I want to change the color of the rows when the number of sold items matches the number of purchased items. I was able to do that with conditional formatting and the formula : =$F4=$I4 . This works ok but my problem now is that all the empty rows change color since there is no data in either of the columns and so they match. I tried filling out the sold items column with 0 but it didn't work. Any ideas ? Thanks.

I used this and it works :
=AND($F4>0,($I4+$J4+$K4)=$F4)
This way the row will get highlighted when the sum of I+J+K = F but only if there is a value bigger than 0 in F.

Related

Power BI: shifting a column one row above

I have a case that I want find the duration for each "state_id", by subtracting its change_time from the time just below it.
So I want to generate a new column that duplicates the column "change_time" and shifting all values one row up, so the change_time #2(in red) would come next to change_time #3(in red).
Is there a way to shift that column one row up?
After a lot of thinking and researching. I have solved it with the following steps:
Sort you columns of interest from A-Z (in my case sort: ticket_id, then history_type_id, then stat_id)
make a first new index column starting from 0 using "Index column from 0".
make a second new index column starting from 1 using "Index column from 1".
merge your query with itself using "merge query" based in the two new indices.
expand the merged query for the date column only.
Now you will have a new date column, duplicated from the old one with a shift of one row.
2)

Input text in one column (a) if the value in another column (b) is found in another column (c)

I have two lists of people - they will not be sorted in the same order. The second list is in a different sheet. If the person listed in column A shows up in Column A in the second sheet, I want column F to display "Y." If not, I want column F to display "N."
This formula: =ArrayFormula(vlookup(A2:A,Attendees!A2:A,1,0)) almost gets me there, but I can't figure out how to get it to return Y/N instead of the name of the Attendee or not.
Any ideas?
try:
=ARRAYFORMULA(IF(IFNA(VLOOKUP(A2:A, Attendees!A2:A, 1, 0))="", "No", "Yes"))

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))

Get total count of each distinct value

If I for example have a column of countries that might repeat and the list follows like this: Spain, Spain, Italy, Spain
I want to get the result that I take the number that a country appears in the column and divide it by total number. I have tried:
CountRows = DIVIDE(DISTINCTCOUNT('Report (7)'[Country]); COUNT('Report (7)'[Country]) )
Any suggestions? do I need a new column for that?
The easiest way to achieve this type of calculation is to add one column with the number of occurrence of the selected words divided by the number of row in the table.
You need to use the function Earlier to get the context.
If you have one table named Table1 and your column Country
Something like :
Divide(COUNTROWS(FILTER(table1, Table1[Country] = EARLIER(Table1[Country]))),COUNTROWS(Table1))
Don't forget to put your new column in Percentage type or add some decimal to see the correct data.

vlookup to find match and return another element in row

i have two sheets. first column of both sheets has userids, but there is only some overlap of ids between the two sheets. i want to keep the userids in the first sheet, but in the second sheet, the second column has a point of data that i want. for those userids in the first sheet that are also in the second sheet, i want to get this data.
so, for say the first row's userid in the first sheet, how could i use vlookup to find that same userid in the second sheet (if it exists), get the value of the second column of that match, and bring it back to the second column of the first sheet?
thanks
Modify and put this formula into the first cell of the second column on the first worksheet. Then copy and paste it down the column:
=VLOOKUP(A1, Sheet2!A$1:B$100, 2, FALSE)
Let's look at the parameters for this function:
A1: This value, on this worksheet, is what we're searching for in the range given in the next parameter. When you copy and paste the entire formula down the column, it increments the row # with each row. In row 2, it will be modified to A2, and so on.
Sheet2!A$1:B$100 : This is the range that we are interested in, on the second worksheet. It is the top left to bottom right cell. The $ symbol tells Excel not to change the row #'s when you copy and paste the formula down the column. Modify B$100 to fit the range of data you are interested in... something like B$30 if you only have 30 rows of id's on the 2nd sheet.
2: This is the column you are interested in retrieving the value, relative to the above parameter. In this case, the 2 corresponds with column B.
False: This instructs Excel to find the exact match.