Accumulate total sum based on value of cells across multiple worksheets - excel-formula

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)

Related

Stacking two list of data on top of each other in excel

I have two excel sheets with one column each.
Sheet1
A
Fruits
Orange
Apple
Grapes
Sheet2
B
Vegetables
Tomatoes
Potatoes
Now, how do I use excel formula and populate on a third sheet stacking just the values
A
Orange
Apple
Grapes
Tomatoes
Potatoes
If your data has a header in Sheet1!A1 and Sheet2!A1 then in Sheet3!A1 you could use (and drag down):
=IF(ROW()<=ROWS(Sheet1!$A$2:$A$4),
Sheet1!A2,
SUBSTITUTE(
INDEX(Sheet2!A:A,
ROW()-ROWS(Sheet1!$A$2:$A$4)+1),
"",""))
If the row number in the new sheet is smaller than or equal to the count of rows in the range of Sheet1 then the result is Sheet1!A2:A4 if the row is greater it'll index Sheet2 column A and will get the result for in that range with the row that equals to the current row number minus the total count of rows of Sheet1!A2:A4 + 1 to take the header into account.
In Office 365 a simple =HSTACK(Sheet1!A2:A4,Sheet2!A2:A3) would do.

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.

text matching with logical function?

Please help me to formulate the following formula:
Actually I am trying to make a costing sheet for recipes.. I am listing all the items in sheet 1 and on sheet 2 all recipes with their quantities of items..
sheet 1
A B
1 item price/gm
2 chicken 10
Sheet 2
A B C
1 item Qty (in gm) cost
2 chicken 150 formula?
now in sheet 2 C2 I need a formula that matches sheet2 A2 with sheet1 column A and then multiply sheet2 B2 with sheet1 B2.. and this will same for all the items in sheet2.. if I put any item in sheet2 it looks up in sheet1 and then multiply the price with qty in sheet2..
Use VLOOKUP:
=B2*VLOOKUP(A1,'Sheet 1'!A:B,2,false)

COUNTIFS using multiple criteria in single formula

Column A has Apples,Oranges, Pears multiple times.
Column B has the count against them (note, some of these may be blank).
I'm looking for a formula to count just Apples and Oranges where their count is neither blank nor 0.
I tried the formula below, but I get the count of Apples only:
=COUNTIFS(A1:A21,{"Apples","Oranges"},B1:B21,">0")
You need to use your formula in a sum function like this:
=SUM(COUNTIFS(A1:A21,{"Apples","Oranges"},B1:B21,">0"))
The reason is, that your function creates an array with the counts of apples and oranges respectively. You have to sum the elements in this array to get your desired result.

How to compare 2 cells to another 2 cells in a different sheet in excel?

I want to know how to compare or know the difference of 2 cells to another 2 cells in a different sheet in excel 2007
Example:
Sheet 1
A B
1 101 KIWI
2 102 APPLE
3 103 BANANA
Sheet 2
A B
1 101 KIWI
2 102 APPLE
3 103 ORANGE
I want to show the there is a difference in 3rd row on Sheet 1 and 2
Thanks
If you put =A1&B1 in C1 of each sheet and copy down then it is like comparing single columns. So with, in D1:
in Sheet1: =MATCH(C1,Sheet2!C:C,0)
in Sheet2: =MATCH(C1,Sheet1!C:C,0)
copied down in each case the resulting numbers should show the row number where the match is on the 'other sheet' (the lists need not be sorted) and otherwise #N/A for where matches have not been found.
There is obviously no need for the concatenation for the example provided, since the two 'A' columns are identical, but I take it that was because the example was simplified.

Resources