A Lookup of ALL values that match a Date - excel

I'm trying to create a sheet that looks through 3 other sheets and combines only the data from all 3 that match today's date.
So if these are my sheets
Data 1:
x y
7/8/2016 Bananas
7/7/2016 Apples
Data 2
x y
7/8/2016 Oranges
7/7/2016 Grapes
Data 3
x y
7/8/2016 Pineapple
7/7/2016 Grapefruit
And I need a formula that returns the following result
x
Bananas
Oranges
Pineapple

Replace Bananas with
=INDEX('Data 1'!B:B,MATCH(Today(),'Data 1'!A:A,0))
Replace Oranges with
=INDEX('Data 2'!B:B,MATCH(Today(),'Data 2'!A:A,0))
and instead of Pineapple you should use
=INDEX('Data 3'!B:B,MATCH(Today(),'Data 3'!A:A,0))
All of the above assumes that the date is in column A of the sheets while the fruits are in column B.
Updated the functions with Today() thanks to #ForwardEd.

Related

How to delete duplicate rows and keep the nth occurrence on Excel?

In Excel I want to delete duplicate rows but I want to have some preferences for what duplicate occurrence to keep. As in Excel while removing duplicates it by default keeps the first occurrence. Is there any way to keep the 2nd or 3rd occurrence?
For example:
a Apple
a Banana
a Cherry
b Apple
b Banana
b Melon
c Apple
c Cherry
c Melon
By default if I remove duplicate, it would be like this:
a Apple
b Apple
c Apple
But is there a way to achieve this
a Banana
b Banana
c ?
As the C doesn't have banana, we can keep this blank, or any default value.
To always keep the second occurrence,
SORT the data,
MATCH the elements among itself to get the first occurrence,
Subtract the matched row number from actual row number and if it's not 1, filter it out.
Input:
Duplicates
Helper column
a
Apple
a
Cherry
b
Apple
c
Apple
c
Cherry
b
Banana
b
Melon
a
Banana
c
Melon
Formula:
=FILTER(SORT(A1:B9,1,1),ROW(A1:A9)-MATCH(SORT(A1:A9),SORT(A1:A9),0)=1)
Output:
Second occurrence
Helper column
a
Cherry
b
Banana
c
Cherry
see:
=FILTER(A1:B, COUNTIFS(A1:A, A1:A, ROW(A1:A), "<="&ROW(A1:A))=2)
for 3rd occurrence change 2 to 3

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.

How to populate columns with data in Excel using unique row combinations between two columns

This seems like it should be easy enough to do, but I can't seem to figure it out or find a tutorial.
I have two columns containing values. I would like the unique column combinations to repeat in another set of columns, and count the instances.
COLUMN A COLUMN B COLUMN C COLUMN D COLUMN E
John Apples John Apples 2
John Apples John Bananas 1
John Bananas Sara Apples 1
Sara Apples Sara Kiwi 1
Sara Kiwi Mike Carrots 2
Mike Carrots Mike Kiwi 1
Mike Carrots Apples 2
Mike Kiwi Carrots 1
Apples Kiwi 1
Apples
Carrots
Kiwi
I was able to transfer the unique values from one column to another using INDEX and MATCH, but can't get it to work with two columns.
This tutorial shows what I am looking for, but I'd like the second set of data to stay in a column, and not transpose into rows. https://www.extendoffice.com/documents/excel/3358-excel-transpose-unique-values.html
Try following this short animated screen capture finishing with the following formula in E2.
=COUNTIFS(A:A, IF(LEN(C2), C2, ""), B:B, D2)
What you describe is called a Pivot Table. Drag Name and Fruit into the rows area and Fruit again into the Values area to have it counted. Pivot tables can have different layouts, i.e. with repeating labels, or in compact format.

Google sheets, adding a value to a cell based on the contents of another

This may be delving in to scripting territory rather than formula, but I was wondering if it's possible to use google sheets to add values to a cell based on the contents of another? For example, If I had a sheet arranged like the following:
Column A|Column B|Column C|Column D
Apples Oranges Grapes
Tomatoes Grapes Oranges
Melons Apples Tomatoes
Grapes Lemons Apples
And then I had another section that had
Column G|Column H
Apples 1
Tomates 2
Oranges 3
Grapes 4
Melons 5
Lemons 6
Is there a formula that will let me populate the contents of column D by reading columns A - C on each row and adding the values set on column H? Making Column D read something like 8, 9, 8 etc?
I hope this question makes sense, thanks and apologies for the shoddy formatting!
=SUMPRODUCT(IFERROR(VLOOKUP(A2:C2,G:H,2,0)))
For google-spreadsheets
Please try this single-formula solution:
=mmult(filter(VLOOKUP(A:C,G:H,2,0),A:A<>""),ArrayFormula(transpose(sign(column(A:C)))))
Paste it in D1.
Here's a sample file of sum with arrayFormula.

Excel COUNTIFS multiple and sequential criteria

Column A has: Apples Oranges Pears Bananas Mangos multiple times and in random orders.
Column C has: Red Orange Yellow Blue Purple corresponding to column A multiple times and in random orders.
I am looking for a formula which counts or sums all instances where Pears immediately follow Apples (i.e. the row below Apples) AND Pears are also Orange
I can return Apples and Pears and even Pears that are Orange but I cannot figure out how to return instances of Pears that are Orange which immediately follow Apples
Use COUNTIFS() with ranges of the same size that are offset:
=COUNTIFS(A$1:A$1040000,"Apples",A$2:A$1040001,"Pear",C$2:C$1040001,"Orange")

Resources