How do I highlight a cell in Excel when all its content is contained in another column - excel

I have a column (column A) that contains a list of text and another column (column B) that contains a smaller list, which is the values that I actually care about. Is it possible to only highlight cells in column A if all of its contents is listed in column B? If so, how?
A B
Apple Apple
Peach Pear
Apple, Pear Plum
Apple, Grape Kiwi
Apple, Pear, Kiwi      
Watermelon, Grape
So in the above example, I would like to highlight A1, A3, and A5 because all of the contents is listed somewhere in column B

use the following formula for the Conditional formatting:
=AND(ISNUMBER(MATCH(FILTERXML("<a><b>"&SUBSTITUTE($A1,",","</b><b>")&"</b></a>","//b"),$B:$B,0)))
If one does not have FILTERXML then they can use:
=SUMPRODUCT(--ISNUMBER(SEARCH("," &$B$1:$B$4&",",","&SUBSTITUTE(A1," ","")&",")))=LEN(A1)-LEN(SUBSTITUTE(A1,",",""))+1
Noting that the range $B$1:$B$4 must be the size of the lookup values without any blanks

Related

Excel: Grouping and restructuring data in Excel

In Excel, I want to convert the table on the top (Initial data) into the one at the bottom (Desired output).
I want to group the items in the second row by the first row, and then generate one column per unique value of the first row and list the items of the corresponding group in that column.
Is there a way to do that without manually copying cells?
Table: Initial data
Fruit
Banana
Fruit
Apple
Fruit
Grape
Vegetable
Spinach
Vegetable
Eggplant
Table: Desired output
Fruit
Vegetable
Banane
Spinach
Apple
Eggplant
Grape
If you have access to the UNIQUE and FILTER functions (Excel 365), you could accomplish this as follows.
Assuming your data is in A1:B5. In D1 enter:
=TRANSPOSE(UNIQUE($A$1:$A$5))
This will get you the unique values from the cells in A in D1:E1. Then in D2 enter:
=FILTER($B$1:$B$5,$A$1:$A$5=D1)
And drag to the right.
I.e. you do this:
Result:

Check if array contains text from a list and when a value apears more then once display that value

What if I have 4 columns with data, and want the value that is more than once in those 4 columns(A-B-C-D).
apple pear melon grape
melon apple melon grape
pear melon melon pear
My list in column E is;
``
apple
pear
melon
grape
And what I would like is that in column F the value appears of the fruit that is more than once in a row.
So F1 should return nothing, F2 should return "melon", and F3 should return "pear, melon"
Is that posible with a formula?
Try,
In B1, array ("Ctrl"+Shift"+"Enter") formula copied down :
=MID(TEXTJOIN(", ",,FILTERXML("<a>A<b>"&SUBSTITUTE(TRIM(A1)," ","</b><b>")&"</b></a>","a|a/b[not(preceding::* =.)][following::* =.]")),4,999)
Remark : If you have Office 365, the above formula is normal entry.
If source data put in separated cells, then formula become >>
In F1, array ("Ctrl"+Shift"+"Enter") formula copied down :
=MID(TEXTJOIN(", ",,FILTERXML("<a>A<b>"&TEXTJOIN("</b><b>",,A1:D1)&"</b></a>","a|a/b[not(preceding::* =.)][following::* =.]")),4,999)
Remark : If you have Office 365, the above formula is also normal entry.

Same value against each cell from a single column?

I have one column like below:
Fruits:
Apple
Banana
Mango
Vegetables:
Broccoli
Tomato
Potatoes
I would like each value to have their parent name next to it in the cell like below:
Apple Fruit
Banana Fruit
Mango Fruit
Broccoli Vegetables
Tomato Vegetables
Potatoes Vegetables
How can I achieve this?
If your data is in column A, I am able to get the result with a helper column, by using the following formula in B1:
=FILTER($A:$A,($A:$A<>"")*(RIGHT($A:$A,1)<>":"))
This will result in your data excluding the titles (fruit, vegetable).
Then in C1 use the following formula and drag down:
=IFERROR(B1&" "&SUBSTITUTE(LOOKUP(2,1/(RIGHT(INDIRECT("$A$1:$A"&MATCH(B1,$A:$A,0)),1)=":"),INDIRECT("$A$1:$A"&MATCH(B1,$A:$A,0))),":",""),"")
As per my below screenshot put below formula to B1 cell.
=IF(RIGHT(A2,1)=":",LEFT(A2,LEN(A2)-1),B1)
Then put following formula to C1 cell
=FILTER(A2:B9,RIGHT(A2:A9,1)<>":")

Excel How to insert value based on todays date

I have 4 columns in excel. Date, Apple, Banana and Oranges. I have a different sheet where I have a header called "Today's Production" Under the header I have Banana, Apple and Oranges listed. How do I populate these fields
Screenshot added
If the first cell of your table were in A1, for the bananas column, you can just use something along the lines of
=SUMIFS(B1:B10,A1:A10,TODAY())
Then for apples, you would adjust your B column to C, and for oranges, adjust B to D

Check if value is a substring in at least of of many strings

i have a column A with strings:
apple
orange
grape
now i have a second column C with many strings:
apples are red
i hate people
squeeze the orange
rotten flesh
clean towels
in column B, i want to put TRUE next to the strings in column A that are substrings of ANY of the strings in column C.
So in this case column B should have:
TRUE
TRUE
FALSE
I looked at this formula on exceljet but not what i'm looking for:
https://exceljet.net/formula/range-contains-one-of-many-substrings
In B1 put:
=ISNUMBER(MATCH("*"&A1&"*",C:C,0))
And copy down

Resources