How do I create a formula for summing the product of cells, based on their value? [duplicate] - excel

This question already has answers here:
excel Formula to sum values in a column based on another value(txt) in any column
(5 answers)
Closed last year.
I have two columns of values. I want to add up the product of the two values, where the 2nd is grater than 1.
Now I'm using a separate 3rd column to aid in this and sumif the values based on the x2 column.
=SUMIF(B1:B9, ">0", C1:C9)
X1
X2
Prod
4
3
12
4
4
16
5
1
5
6
0
0
10
4
40
The result in this case should be 12+16+40 = 68
Is it possible to do the same without the 3rd column?

Below should work
=SUMPRODUCT((A2:A6)*(B2:B6)*(B2:B6>1))

Use the FILTER() function, using the 2nd column as the test.
=SUM(FILTER(A1:A5*B1:B5,B1:B5>1))

I found another solution that I have somehow missed before
=SUMPRODUCT( --(B1:B9 > 1), A1:A9, B1:B9)

Related

Vlookup does not return the result on the index number [duplicate]

This question already has an answer here:
Excel Vlookup Function
(1 answer)
Closed 10 months ago.
I am implementing the VLOOKUP in the excel
When I use the index 3 it works
when I put index 4 it does not return anything .
Both the index has some values. It should return . What could be the problem ?
This is Monthly sheet columns .. it has columns till M
You table has 3 columns A, B & C, so using 3 picks the result in column 3, but 4 won't exist as there is no column.
You gave the range in Table_Array as Monthly!A:C, so it won't know about any columns after column C as shown in both your images, only one shown here:
So do the correction and put Monthly!A:M then you can address the rest of the columns, until then it will not work.

Excel mapping and create a new column

Excel file columns:
A B C
2 two 3
5 five 8
3 three 10
8 eight 11
12 one 15
I want to create a new column Din same file like below:
A B C D
2 two 3 three
5 five 8 eight
3 three 10
8 eight 11
12 one 15
I want to map C and A and if there's a match D takes values of B.
Example: Value 3 in C is present in A, so D will take corresponding B value three.
Thanks!
So building on BigBen's additional suggestion of using an IFERROR, I believe you want something akin to this in Column D:
=IFERROR(VLOOKUP(C1, A:B, 2, FALSE), "")
... and then drag down the formula throughout Column D
Now, there are some assumptions being made here:
Your data does not have any header row, ala the data starts in Row 1, not Row 2
You want empty/blank values where there is no exact match (this is BigBen's IFERROR suggestion). Your current question layout seems to suggest this. Otherwise, you'll get #N/A in all those blank cells in Column D.
EDIT: To confirm, I used your data (though I started in Row 2), and here's how it looked after -
If one has DA-functionality you could use:
1) - Excluding empty cells using FILTER:
Formula in D1:
=FILTER(B1:B5,COUNTIF(C1:C5,A1:A5)>0)
2) - Including empty cells using XLOOKUP:
Formula in D1:
=XLOOKUP(C1:C5,A1:A5,B1:B5,"")
If one does not have access to DA-functionality you could use:
1) - Excluding empty cells using INDEX, MATCH and SMALL:
=IFERROR(INDEX(B$1:B$5,SMALL(IFNA(MATCH(C$1:C$5,A$1:A$5,0),""),ROW(A1))),"")
Note 1 - This needs to be array entered through CtrlShiftEnter
Note 2 - Alternatively, one could use a non-array entered approach including AGGREGATE as per #basic: =IFERROR(INDEX(B$1:B$5,AGGREGATE(15,6,MATCH(C$1:C$5,A$1:A$5,0),ROW(A1))),"")
2) - Including empty cells using VLOOKUP:
Please refer to the other answer given by #Gravity here.
Basically the difference between both approaches could be vizualised like:

How do I make a cell value represent a number in Excel?

I have
Year 1 2 3 4 5 6
I'm trying to make it so that each year number 1-6 is equal to another number value i.e. Year 1 is equal to 5. Year 2 is equal to 6.
You will not be able to store one value in a cell and use a different value for calculation. However you may do this calculation with the help of a lookup from another table,
Assuming you have the years in Column A and the corresponding mappings are in Column E and F, you can use the below formula in Column B,
=INDEX(E:F,MATCH(A1,E:E,0),2) * 2
This formula lookups the value in A1 in the table E:F and returns the corresponding Column F element. That is finally multiplied with the 2 to show your result. Instead of just using just A1 for multiplying by 2, you should be using INDEX(E:F,MATCH(A1,E:E,0),2). Hope this helps.

Excel lookup 2 Values

I'm sorry if this is an obvious question, but I've been searching and can't seem to figure this out..
Cost TableCost Table
Employee Date Hours
2 03/16/16 8
2 03/17/16 8
2 03/20/16 8
3 03/21/16 8
3 03/22/16 8
5 03/23/16 10
6 03/24/16 4
6 03/28/16 5
Time Clock Table
Employee Date Hours
2 03/16/16 1
2 03/17/16 3
2 03/20/16 2
3 03/21/16 5
3 03/22/16 4
5 03/23/16 7
6 03/24/16 7
6 03/28/16 7
I just want to lookup on this table to see how many hours each employee worked on a certain date. They are cheating the system and we need to find out who's short.
You can use a formula like this
=INDEX(TableCostTable[Hours],MATCH([#Employee]&[#Date],INDEX(TableCostTable[Employee]&TableCostTable[Date],0),0))
It concatenates the name and the date and uses Index/Match to look up the same combination and returns the hours. The formula uses structured references with the column names and header names. It will also work if you use sheet names and cell references, but don't use it with whole columns, because that will be very slow.
You need a SUMIFS rather than a VLOOKUP, in this case
=sumifs(Paytable!C:C, Paytable!A:A,2,Paytable!B:B,date(2016,3,17))
You can solve this through a SUMIFS formula, such as:
=SUMIFS(C:C, A:A, 2, B:B, "03/07/16")
What this is doing is summing all values in column C where column A is equal to 2 (for the employee) where column B is equal to 03/07/16.

I WANT CALCULATE SUM IN EXCEL

I HAVE A QUESTION ABOUT SUM IN EXCEL:
I have many rows in excel.
I want to calculate sum of each row in one formula
for example
A B C D E
2 3 5 6 8 24
4 5 6 8 9 32
BUT do not USE separate formula FOR EVER CALCULATION (FOR EXAMPLE =sum A1:D1)
CAN I USE WITH ONE FORMULA TO CALCULATE SUM OF EVERY ROWS
You do not have to manually enter the formula to calculate sum of every row.
In the first row you would input =SUM(A1:D1) (did you mean to include E1 as well?)
Then follow the instructions here to apply it the other rows

Resources