Statement for checking IF multiple cells CONTAIN certain text - excel

I have a column of values, and then I have two columns with simple marking like just an 'X':
A B C
1
2
3 VALUES: PERSON1: PERSON2
4 500 X
5 180 X
6 100 X
7 200 X
8 TOTAL:
9 =SUM(A4:A8) ?? ??
Can I create a statement that will check that if a box has an X in it the value of the A-column cell on the same row will be subtracted from the total summation?
In the example above PERSON2 should have a statement with the values '=980-180-100' which is 700.
I can easily do it for one cell: =IF(B4="X", A9-A4) but I can't quite get around with doing with multiple.

I suspect:
=SUM(A4:A7)-SUMIF(B4:B7,"X",A4:A7)
is what you are after, or perhaps:
=SUM(A4:A7)-2*SUMIF(B4:B7,"X",A4:A7)
but a better solution is from #barry houdini:
in B9 try this formula copied to C9 =SUMIF(B4:B7,"<>X",$A4:$A7)

You can use something like
=$A9-SUMIFS($A4:$A7,B4:B7,"X")

Related

EXCEL Sum up points based on placements (combine VLOOKUP and SUM)

e.g. I have a list of race results:
A B C D E F...
NAME P. RACE1 RACE2 RACE
abc =? 1 3 3
bcd 3 2 4
cde 4 4 2
def 2 1 1
and another sheet with points for each result:
A B
PLACE POINT
1 10
2 5
3 2
4 1
Is it possible to get the total points in sheet1 column B based on the race results in column C-E..?
Is it a connection from VLOOKUP and SUM?
Yes, that's possible. You can use a SUMPRODUCT formula for that. You may use this one in column B:
=SUMPRODUCT((C2:E2=$A$13:$A$16)*$B$13:$B$16)
Your result will look like this:
This is an array function. The term C2:E2=$A$13:$A$16 will check for race 1 to 3 if it was 1st, 2nd, 3rd or 4th place. This will result in an "imaginary" array of TRUE and FALSE. For name "abc", it will look like that.
Those results are then multiplied with the points from B13:B16 and the sum is formed.
In Excel O365, one could use:
Formula in B2:
=SUM(VLOOKUP(C2:E2,H$2:I$5,2))

how to reference a specific cell in a formula if other cells match a specific value

Thanks so much for looking at my question! I am trying to create a formula that subtracts a specific value from another formula. However, that specific value may change.
Example:
A B C D
1 1 100 =(2000 - ( if A = 1, i want to subtract the C value where B =1))
1 2 250
1 3 310
1 4 .
2 1
2 2 =((2000 - ( if A = 2, i want to subtract the C value where B =1))
2 3
2 4
3 1
3 2
3 3
3 4
(A,B,C,D are the columns)
Hopefully this makes sense! I am trying to subtract the C value that goes along with the B1 value for each different A.
I was thinking an index match of some sort but wasnt exactly sure how to do that when the A's change. Thanks so much in advance for help!
INDIRECT or INDEX functions can help you. See this answer.
Would something like a nested if function work for you here? For example:
=IF(A2=1,IF(B2=1,2000-C2,"Enter calculation if B2<>1"),"Enter calculation if A2"<>1)
If this works, then you can simply copy/paste the function down the rows in column D.

Excel using SUMIF to calculate totals of multiple columns

I'm trying to use Excle's SUMIF to calculate totals of Col1 to Col5 for dates that are similar.
My formula is as follows =SUMIF($A2:$A7,A10,$B2:$F7), but this only gives me the total of a single column.
How can I get the Totals of all the columns based on the date like I've shown in my results.
Date Col 1 Col 2 Col 3 Col 4 Col 5
1/5/2017 1 2 2
1/5/2017 5 3 1
1/5/2017 9 5 5
2/5/2017 10 5 3
2/5/2017 20 10 3
2/5/2017 6 8 1 5
Desired Results
1/5/2017 15 7 7 3 1
2/5/2017 30 11 11 11 8
use below formula in cell B11
=SUMIF($A$2:$A$7,$A11,B$2:B$7)
Per the example you provided, One solution is to use SUMPRODUCT
Multiplies corresponding components in the given arrays, and returns the sum of those products
Microsoft Docs give a thorough example, but per SO etiquette, here is an example in case of link-rot: [FYI, I used absolute reference for easier filling across, arbitrary how you get it done though]
Forumlas shown:
Formula is kind of hard to see without clicking on image:
=SUMPRODUCT(($B$3:$B$8=$B$11)*C3:C8)
This basically breaks down like this, it searches the B:B column for a match, and it will naturally return a true or false for the match, or 0/1 counterparts, and multiplys that by the number found in the column to the right (C3:C8), so it will either be 1 * # = # or 0 * # = 0

array based on max and less than?

I'm not sure if I'm over complicating this...
basically I'd like to have a formula which is
if the c column is less than 6, then look up the max value in B but display the value of C
so far I have this but I'd like it to show 2, not 437
{=MAX(IF(C2:C12<6,B2:B12, 0))}
any advice is appreciated. i'm shy, be nice..thanks
A B C
cat 110 3
dog 148 4
rooster 36 7
duck 32 8
pig 437 2
horse 44 6
eagle 215 5
dolphin 21 1
panda 2 9
iguana 257 10
fish 199 11
edit:
maybe something like
{=INDEX(C2:C12,MATCH(MAX(IF(C2:C12<6,C2:C12)),C2:C12,0))}
but I don't see where to put b2:b12
You really need two conditions
1) Column B is equal to =MAX(IF(C2:C12<6,B2:B12))
2) Column C is <6
so you can INDEX column C when those two are met, i.e.
=INDEX(C2:C12,MATCH(1,(B2:B12=MAX(IF(C2:C12<6,B2:B12)))*(C2:C12<6),0))
confirmed with CTRL+SHIFT+ENTER
{=IF(C2<6,INDEX($C$2:$C$12,MATCH(MAX($B$2:$B$12),$B$2:$B$12,0)),0)}
You were almost there..
Basically if C<6 , find max of B , lookup it in B:C and display corresponding C
{=IFERROR(VLOOKUP(MAX(IF(C2:C12<6,B2:B12, 0)),B2:C12,2,FALSE),0)}
Since your question doesn't clarify what if c>=6 I assume you don't want value.
Can answer more precisely if you clarify.
Mark this as answer if that's correct.
Hope this helps!
As I could see you requested a single INDEX formula:
{=INDEX($C$2:$C$12,MATCH(MAX(IF($C$2:$C$12<6,$B$2:$B$12,0),0),IF($C$2:$C$12<6,$B$2:$B$12,0),0))}
This is an array formula, hit Ctrl+Shift+Enter while still in the formula bar.
Lets break this down.
=INDEX(C:C, - Index column C as these are the values you want returned
MATCH(IF(C:C<6,B:B,0), - Find the largest value from the following array in the array and return it's relative position for INDEX()
IF(C:C<6,B:B,0),0)) - If the value in column c is less than 6 then add the column B value to the array, otherwise add 0

Finding the first specific value above a certain cell

I'm looking for a way to find the first specific value above a certain cell.
Using the example below, in the result column every time I hit a A in COL2, I need to substract the value in COL1 to the first A value above.
The trouble seems finding a way to keep the range dynamic...
I thought of =IF(B5="A";A5-INDIRECT("A"&MATCH("A";B:B;0));"")
But of course that only works for the first one as Match will always pick up the first one.
Any ideas? Thanks!
Example :
COL1 COL2 Result
1 A
2 0
3 0
4 A 4 - 1 = 3
5 0
6 A 6 - 4 = 2
7 0
8 0
9 0
10 A 10 - 6 = 4
Try this:
=IF(AND(ROW(B2)<>2,B2="A"),A2-INDEX($A$1:$A1,AGGREGATE(14,6,ROW($1:1)/($B$1:$B1="A"),1)),"")
The AGGREGATE() Function was introduced in 2010.
In D2 enter =IF(B2="A",A2-INDIRECT("A"&MATCH("A"&(E2-1),F:F,0)),"")
In E2 enter =IF(B2="a",COUNTIFS($B$2:B2,"a"),"")
In F2 enter =B2&E2
Copy formulas from D, E and F down all your rows
Column D is the result you're looking for

Resources