Subtracting cells only when there is a value on another cell - excel

My spreadsheet looks something like this:
A1 B1 C1 D1 E1 F1
10 7 2 5 11 =SUM(A1:E1)
A2 B2 C2 D2 E2 F2
X X X =18
A3 B3 C3 D3 E3 F3
X X =17
On the F column starting from F2 I want excel to sum the value from F1 and subtract values where the letter X is present. In my example the sum on cell F1 is 35.
The value on F2 should therefore be:
35(retrieved from F1)
-10(letter X is present on A2 and since A1 has the value 10 we subtract that value)
-2(same thing here, letter X is present on C2 and since C1 has the value of 2 we subtract that value)
-5(and same here aswell, D2 has letter X present and since D1 has the value of 5 we subtract that value).
So 35-10-2-5=18. The value of F2 should be 18.
And on F3 in my example the value should be 35-7-11=17.
This formula should work for every row starting from F2.
How can I achieve this?
I'm thinking maybe using the IF ISBLANK function but I'm a noob.

This is a simple SUMIFS formula
=SUMIFS($A$1:$E$1,$A2:$E2,"")

put this in F1 and copy down. You must enter the formula with Ctrl-Shift-Enter, as it's an array formula:
=SUM(IF(A1:E1="x", 0, $A$1:$E$1))

Related

Copy cell value only if is min two cells is empty

[
copy A1 to E1 only if min two cells is empty from B1 to D1
If all cells from B1 to D1 have any value, do nothing
If two cell have any value from B1 to D1, do nothing
Use COUNT to count how many numbers and if less than 2 put the value:
=IF(COUNT(B1:D1)<2,A1,"")

How can I change the formula of the cell according to the value of another cell

If Cell A1 = X, Cell B2 = sum(A1+A2)
If Cell A1 = Y, Cell B2 = sum(A1+A3)
is excel capable of doing this? if not using VBA
let A1 have a value of 5
let D2 have a value of 5(Where this would represent your Y.
then B1 have a value of =if(A1=D2,SUM(A1:A3),SUM(A1:A2))
Try this in B2,
=sum(A1, if(a1="X", A2, if(a1="Y", A3, "")))
Of course you cannot get any numerical value from X or Y so using A1 as part of the sum is pretty useless but you can modify for you own purposes.

Conditional transpose of rows to columns

I have the following table with around 500 rows that I need to transpose into columns:
A B
A1 B1
A2 B2
A3 B3
The result I'm trying to get is
A B C D E F
A1 B1 A2 B2 A3 B3
Because the results are to be the interleaving of two columns I think not a duplicate of the OP indicated (at one time). Assuming A1 is in cell A2 (i.e. A and B are column labels) I suggest in C2 and copied across to suit:
=IF(ISODD(COLUMN()),OFFSET($A1,COLUMN()/2,0),OFFSET($A1,(COLUMN()/2)-1,1))

Excel Concatenate multiple cell, one is the same the other change

I have an excel file. B1 has the text value ME. B2 has a number value 01.
From C1 to C100 the values are shot001 to shot100.
I would like to do a formula in G1 that concatenates: B1+B2+C1 then in G2 I needB1+B2+C2 then in G3 I need B1+B2+C3.
I've done a formula in G1 = CONCATENATE(B1,B2,"_",C1). If I drag the formula along the G column the value B1 and B2 change in B3 and B4, then in B5 and B6.
My problem is that I don't know how to force the formula to use ALWAYS in each formula B1 and B2.
Use dollar $ sign to fix cell coordinates. $B1 will fix column B if you drag horizontally. B$1 will fix row 1 if you drag vertically. $B$1 will fix both row and column wherever you drag:
=CONCATENATE($B$1,$B$2,"_",C1)
When you use the formula in G1 of:
=CONCATENATE(B1,B2,"_",C1) -> [B1][B2]_[C1]-> -> ME01_Shot001
then if you fill down each row will update the respective cell reference, so for example G2 will fill to:
=CONCATENATE(B2,B3,"_",C2) -> [B2][B3]_[C2]-> 01_Shot002
To keep the formula always referring to cells B1 and B2, you need to lock them down using a $ in the code. This will keep the absolute value of the cell rather than the relative value. So, the formula for G1 should instead be:
=CONCATENATE(B$1,B$2,"_",C1) -> [B1][B2]_[C1]-> ME01_Shot001
Then when you drag down, the formula in G2 will become:
=CONCATENATE(B$1,B$2,"_",C2) -> [B1][B2]_[C2]-> -> ME01_Shot002
You can read more about the use of $ and absolute vs. relative HERE
Also, for future reference the below code would also work:
=B$1&B$2&"_"&C1 -> [B1][B2]_[C1]-> ME01_Shot001

Get all combinations of the first column's value and other column's value

I have an irregular table in Excel:
A A1 A2 A3
B B1
C C1 C2 C3 C4
...
How can I get the following its representation?
A A1
A A2
A A3
B B1
C C1
C C2
C C3
C C4
...
This answer in SuperUser to Transform horizontal table layout to vertical table using VBA appears to give exactly what you are looking for.
The code is self explanatory by virtue of working step by step.
Hope it helps.

Resources