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")
Related
I am looking for a formula in excel that will calculate the sum of a given cell based on the value in a different cell, across all worksheets.
That is, I would only like the sum of a cell based on the criteria of another column, across multiple worksheets if the value matches.
Worksheet 1
19 apples
2 oranges
57 pears
Worksheet 2
2 apples
13 oranges
3 pears
Summary
apples: (from all worksheets)
I would like to know how many apples I have total from every worksheet, but have not been able to properly work out the sum-if...if thats the correct tool. The sums I want to add are always in the same column across worksheets, and the criteria is always in the same column. But criteria column is never in the same order
The solution I used was this:
Input this formula into the desired Total Cell on your summary or totals worksheet
=SUM(Worksheet1:Worksheet2!<cell>)
So if in worksheet1 you have
A1 B1
19 apples
2 oranges
57 pears
And in worksheet2 you have
A1 B1
2 apples
13 oranges
3 pears
The formula that would go on your summary or totals worksheet for total apples would be as follows:
=SUM(Worksheet1:Worksheet2!A1)
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.
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.
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.
What I need is probably best described in an example. It's a bit different from the group functionality and also the PivotTable in Excel, because I want it to show up in the data row itself (and not off to the side or below, etc.). Given a table like:
Fruit Color Farmer
Banana Yellow Smith
Banana Yellow Smith
Apple Yellow James
Apple Yellow James
Apple Green Smith
Banana Yellow James
I want to take the first two columns and give the count of rows that have the same values (regardless of the values in the other columns). So for my example, I would get:
Fruit Color Count Farmer
Banana Yellow 3 Smith
Banana Yellow 3 Smith
Apple Yellow 2 James
Apple Yellow 2 James
Apple Green 1 Smith
Banana Yellow 3 James
My preference would be an Excel formula (or even a built in function) as opposed to VBA.
Assuming Fruit is in A1, please try in C2 (having made room for it):
=COUNTIFS(A:A,A2,B:B,B2)
and copy down to suit.