Excel function using value from previous function not working - excel

I'm trying to use the following max function by the group in column A. The value I want in C is the max entry of each group in column B. When column B is normal numbers, this function works. However, I would like column B to be populated by the results of a different function (in this case an =IF function that successfully returns a number). When I do this, I get 0's.
in column C: =MAX(IF($A$2:$A$5=C2,$B$2:$B$5))
Column A
Column B
Column C
Group 1
5
5
Group 1
4
5
Group 2
6
7
Group 2
7
7
Column A
Column B
Column C
Group 1
=IF(...)
0
Group 1
=IF(...)
0
Group 2
=IF(...)
0
Group 2
=IF(...)
0
Any idea what could be going on? Please let me know if I can provide anything additional to help explain.
Thank you!
Reese

Related

Sum values of one column depending on the ID of another

I have a table with many values as such (this is an oversimplified example):
IDx
Namex
Pricex
1
a
5
2
b
2
1
a2
5
3
c
3
2
b2
9
and another table with only the ID, in which I'd like to add a column that shows the addition of all the values that match that ID, in this example:
IDy
Totaly
1
10
2
11
3
3
I'm guessing this is a combination of vlookup with sum or sumif, I've tried so far:
=SUM(VLOOKUP(IDy1,$IDx$1:$IDx$5,$Pricex$1:$Pricex$5),// don't know how to proceed here
Try this:
B5:B9 = IDx
B16,D5 = Price
=SUMIF(B$5:B$9,B16,D$5:D$9)

Filtering two columns: keep all the rows associated to one ID if exists a value in the second column

I have a table with various columns but i need to filter it based on two, the table structure is the following:
ID Test
1 A
1 B
1 C
2 B
2 D
3 A
4 A
4 C
4 D
5 B
5 C
What i need to do is keeping all rows associated to one ID if exists the case where the test is "A", the filtered table should then be:
ID Test
1 A
1 B
1 C
3 A
4 A
4 C
4 D
Is there a way to do this?
Alternatively you can use:
=FILTER(A1:B11,COUNTIFS(A1:A11,A1:A11,B1:B11,"A"))
Or, based on your comment:
=LET(X,COUNTIFS(B1:B11,B1:B11,L1:L11,"A"),INDEX(FILTER(B1:L11,X),SEQUENCE(SUM(X)),{1;11}))
If you have Excel365 and access to dynamic formulas then try below-
=FILTER(A1:B11,ISNUMBER(MATCH(A1:A11,UNIQUE(FILTER(A1:A11,B1:B11="A")),0)))

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.

How to increment value based on duplicates and grouping

I have three columns, and I need column C to increment if there is a duplicate in column B, but only if the data is in the same group in column A:
A B C
1 Group 1 AB123 1
2 Group 1 SD244 1
3 Group 1 AB123 1 * should be 2
4 Group 2 FF444 1
5 Group 2 CD444 1
6 Group 3 AB123 1 * should stay as 1
7 Group 3 AB123 1 * should be 2
So basically Since AB123 is found again in column B in row 3, C3 increments by one, but C6 doesn't because it's in a different group (and then C7 does again because it 's in the same group as C6).
When I use COUNTIF($B$1:B1, B1), it doesn't increment by grouping also. Anyone have any idea how do it?
**edit
got it to work: used countifs($A$1:A1, A1, $B$1:B1,B1)
Well, if you could sort it by Column A and then Column B, you could write some nested IF statements that, for C2 for example would be something along the lines of: C2 =IF(A2=A1,IF(B2=B1,C1+1,1),1) syntax might be slightly off, but I think that should get you close, but only if you do the double column sort, otherwise, I don't know any simple way to do it.
I have just been trying to do this in Office 2016 with my data in the table, I found the following worked:
=COUNTIFS(Table1[[#Headers],[COLUMN1]]:[#[ COLUMN1]],[#[ COLUMN1]],Table1[[#Headers],[ COLUMN2]]:[#[ COLUMN2]],[#[ COLUMN2]])

Excel - Finding Max value in a column

I have an Summary sheet set up data set up as follows-
Cat A Cat B Cat C Cat D
Name 1 0 0 0 0
Name 2 2 3 2 2
Name 3 2 2 2 2
Name 4 3 2 2 3
Name 5 2 3 2 3
I also then have separate tabs for each of Name1 through to Name 5.
The summary sheet contains the maximum values for each category from each tab. So the Cell at Cat A Name 1 should show the maximum value on Sheet(Name1) in the Cat A column.
So far so good. However each tab may not contain the same categories, so therefore I would like teh summary sheet to check the maximum value in each column by doing a search on the Cat name.
So far I have this-
=MATCH(Overview!S$1,Name1!$C$1:$V$1,0)
Which returns the column number with the right Category, in this case 13. So I can find the right column. What I am struggling with is to now find the maximum value in the column.
Can anyone help?
Thanks
IAssuming your search range goes to row 1000:
=MAX(INDEX(Name1!$C$2:$V$1000,0,MATCH(Overview!S$1,Name1!$C$1:$V$1,0)))
The 0 Row argument in Index means to select the entire column.
The Offset function is your key here.
After you've got the value from the match, you can pass it to the offset to get the correct column.
So, for example, you probably want something like:
=Max(Name1!$C1:$C2000)
But you don't know whether you should use the C column or the D column or whatever, in this case, it was 13, so is that the P column? (c=3, the match was 13 so 3+13 = 16 = P?), so I think you want something like this:
=Max(Offset(Name1!$C$1:$C$2000, 0, [result of your match expression] - 1))
Here's an example of what I think you want in GoogleDocs:
https://docs.google.com/spreadsheet/ccc?key=0Ai45AJPc2AWMdGRlZXNIdlZBaHJxc01qVlJWa1N1WXc

Resources