Sum fields in a column if there is an entry in a corresponding row in another column - excel

Assume the following data:
| A B C
--+------------------------
1 | 2 3 5
2 | 2 3
3 | 4 4
4 | 2 3
5 | 5 6
In cell A6, I want Excel to add cells C1, C2, C3 on the basis that A1, A2 and A3 have data in. Similarly, I want B6 to add together C1, C4 and C5 because B1, B4 and B5 have data.
Can someone help?

In A6 enter:
=SUMPRODUCT(($C1:$C5)*(A1:A5<>""))
and then copy to B6:

A simple SUMIF formula will work
=SUMIF(A$1:A$5,"<>",$C$1:$C$5)
Place that formula is cell A6 and then copy it to B6.

You can create another column, e.g. AValue, with the formula =IF(ISBLANK(A1),0,A1) in it. This will return 0 if the cell in A in the corresponding line is empty, or the value from the cell in A otherwise.
Then you can just sum up the values of the new column.

Related

Increment row reference based on index in selection, and not same row number between sheets

I have a workbook containing two sheets. Sheet 1 has values in column A for every row up to row number 2000. Sheet 2 should duplicate the values over multiple rows for each row in Sheet 1. Like this:
Sheet1:
a1 | 123
a2 | 456
a3 | 789
and for Sheet2:
Sheet2:
a1 | 123
a2 | 123
a3 | 456
a4 | 456
a5 | 789
a6 | 789
The duplication is fairly simple, where I just put a reference of the next rows to the row collecting the row value from Sheet1:
a2: =a1
However, selecting and dragging rows a1 and a2 in Sheet2 to get the corresponding formulas copied over to the next rows, the formula does not reference the correct rows in Sheet1. Something like this occurs:
Sheet2:
a1 | 123
a2 | 123
a3 | 789
a4 | 789
Where cell a3 in Sheet2 references cell a3 in Sheet1, instead of cell a2 which is the next row. I have tried several functions with index, offset etc. but none of them seem to circumvent the automatic same-row-reference between the worksheets. Any quick ideas?
"generic approach" imho is either one of these.. :
Just edit the "2" in the 1st comment ans.
use ROW() and argument for OFFSET()
'Manually' build the reference using INDIRECT
set the 1st 2 row manually, 3rd row onward use =IF(A2=A1,INDIRECT("Sheet1!A"&(row()+1)/2,TRUE),A2) and drag downwards.
Is this what you are looking for?

Fill blank cell in Excel with value with same ID

I'm not so advanced in excel I need help if is it possible to do.
I have an excel with this column:
ID - Value1 - Value2
I need to update the value1 (or value2):
- only if are blank AND only if the row has the same ID
I make an example, I have this table:
ID Value1 Value2
A1 1 100
A2 2
A3 3
A4 1 200
A5 2 250
Iwould like to fill all the empty cell in this way
ID Value1 Value2
A1 1 100 200
A2 2 250
A3 3
A4 1 100 200
A5 2 250
Thank you for any help.
Ok, so your data is a mixture of numbers and texts. You can generate two new columns with the desired values using formulas. Choose two new, adjacent columns, say D and E, and enter this CSE formula in row say in cell D2:
D2:
=IFERROR(IF(ISBLANK(B2),INDEX(B$2:B$99,
MATCH(1,($A$2:$A$99=$A2)*(1-ISBLANK(B$2:B$99)),0)),B2), "")
CtrlShiftEnter
Enter the formula in D2 with CtrlShiftEnter and then copy/paste in the cells of columns D and E (or as I said any two adjacent columns).

Excel: Given a cell in column B as input, how could I find out the lowest cell of A which B > A?

I have an excel sheet, which value of column A >= B in the same row.
I would like to know given a cell in column B, how could I find out the lowest cell of A which B > A? (It should return a cell address but not the value)
For example, the following shows cells from A1 to B7 in a sheet:
A B
------
1 | 1 1
2 | 3 2
3 | 5 3
4 | 7 4
5 | 9 5
6 | 10 6
7 | 15 10
Now I would like to input B6, then it should return A3 (since 6 > 5)
Another example, if I input B7, then it should return A5 (since 10 > 9)
Is there any approach (or similar approach) by using excel formula? Or should I use other methods?
If your input value is in cell E1, and your return value is in cell E2 (as shown in below image), then you can use this formula in cell E2:
=IF(E1="","",INDEX(A1:A7,MAX(1,MATCH(TRUE,INDEX(A1:A7>=E1,),0)-1)))
Input Cell E1 (enter the address from column B here)
F1: =ADDRESS(LOOKUP(2,1/(INDIRECT(E1)>ColA),ROW(ColA)),1,4)
Given your data, if you enter B6 in E1, A3 will show in F1

How do I link the content of a cell to another worksheet as opposed to the value?

I realize my title doesn't really explain what I'm asking as I don't know the correct terminology but bear with me and I'll explain my question.
I know how to link two cells so that if one changes, the other does as well (i.e. cell C3 is linked to cell E5 by selecting cell C3 and entering "=E5"). But how do I link the information in the cell to another cell?
If my worksheet looks like this:
cell B1 - Grapes, cell C1 - 50
cell B2 - Apples, cell C2 - 60
and I link cell F1 to cell C2 with "=C2". If I change the order of cell B1 and cell B2 to become alphabetical then cell F1 is no longer linked to the value in cell C2 (50) but changes to the value that now becomes cell C2 (60). How do I link cell F1 to the actual value (50) in cell C2 even if the order changes.
Help... Thank you!
Not sure if this is an efficient method; if i correctly understood your question then you can use = to link two cells For example:
Sheet one can look like this
A B C D E
1 1 2 3 4 5
2 5 4 3 2 1
3 1 2 3 4 5
Total 7 8 9 10 11
Sheet two requires cell links so you do:
TotalForA =Sheet1!A4 //output will be 7
TotalForB =Sheet1!B4 //output will be 8
.
.
.
In a simple word you can use = sign and click on whatever cell you're like to get.

extract data from column based on subset of data from other other column

This is how my data looks like:
C1 C2 C3
1 1 a
2 2 a
3 3 a
4 4 a
7 5 a
8 6 a
9 7 a
10 8 a
9 a
10 b
You see that C1 is a subset of column C2. I want now to extract only the data from C2 - together with the corresponding value from C3 - that matches C1. The extracted data just needs to be copied to another column
Could someone give me a hand?
Assuming your data in C1 starts from A2, do the following:
Type in cell D2 (column C4): =IFERROR(VLOOKUP($A2,$B:$C,1,0),"")
Type in cell E2 (column C5): =IFERROR(VLOOKUP($A2,$B:$C,2,0),"")
Autofill both formulas.
This will give you what you want, missing values will be shown as blanks. If you want concatenate both parts of out - just put the aggregate formula =ISERROR(...)&ISERROR(...) to any column row 2 you like.
Sample file: https://www.dropbox.com/s/qglyxmu3tkfxy7g/DataExtract2Cols.xlsx

Resources