Excel - Finding Max value in a column - excel

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

Related

Presenting a value based on number or text in cell

I have a list of 4 values in Sheet1 and 4 values in Sheet2.
In Sheet3 I will combine a random selection of these numbers and return the value in a column. (edit: no random selection from Excel, its a part picked from a bucket)
(A fifth column in Sheet3 will be used to do calculations with ValueS1 and ValueS2)
Sheet1
NumberS1
ValueS1
1
17.10
2
17.20
3
17.12
4
17.15
Sheet2
NumberS2
ValueS2
1
16.10
2
16.20
3
16.12
4
16.15
Sheet3
NumberS1
NumberS2
ValueS1
ValueS2
1
3
17.10
16.12
2
2
17.20
16.20
4
1
17.15
16.10
3
4
17.12
16.15
What kind of function can give the desired return?
I have looked into examples using "Indirect" but cannot see how they will solve my problem.
for the randomization: =ROUNDUP(RAND()*4,0)
rand() gives you a number between 0 and 1, so rand()*4 gives you a number between 0 and 4.
roundup(x,y) round up the number x with y digits you want to round the number up to (in our case 0).
for import the right number from sheet 1 or 2: =VLOOKUP(A1,Sheet1!A1:B2,2,0)
A1 - The value you look for in sheet 1 or 2.
Sheet1!A1:B4 - The array he look for your value on the firs column, always on the first column.
2 - The column you want to import the value from. (because we write an array of tow columns. we can write here only 1 or 2)
0 - it's an Optionally index (0 or 1). o is if you want an exact match of the return value.
Regular Lookup could do:
=LOOKUP(A2:A5,Sheet1!A2:A5,Sheet1!B2:B5) in Sheet3!C2
And
=LOOKUP(B2:B5,Sheet2!A2:A5,Sheet2!B2:B5) in Sheet3!D2
Note that LOOKUP will give the result to the closest match smaller than the search value.
Or VLOOKUP:
=VLOOKUP(A2:A5,Sheet1!A2:B5,2,0) / =VLOOKUP(B2:B5,Sheet2!A2:B5,2,0)
VLOOKUP will error if the value is not found (the way used above). It uses arguments like this:
=VLOOKUP(What you want to look up, where you want to look for it, the column number in the range containing the value to return, return an Approximate or Exact match – indicated as 1/TRUE, or 0/FALSE)
Office 365 has XLOOKUP which combines the logic of the two above and some more:
=XLOOKUP(A2:A5,Sheet1!A2:A5,Sheet1!B2:B5,"value not found",0)
XLOOKUP uses the following arguments:
=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])

Excel function using value from previous function not working

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

Retrieve column 4 from Column 2 and 3 which contains minimum and maximum conditions along with Column 1 which is a separate value?

Hello I have a table shown below where I have letters in column 1, and min and max ranges for column 2 and 3. I am trying to retrieve the final number in column 4.
I know I can use a VLOOKUP and set the range as TRUE to get the last column. However, how would I factor in multiple columns/criteria to find match the correct range with the correct letter.
For example, I can would like to get value 4 from the last column. I would have to match with "B" and it would be between 0 and $50,000.
A 0 $50,000 1
A $50,001 $100,000 2
A $100,001 $250,000 3
B 0 $50,000 4
B $50,001 $100,000 5
B $100,001 $250,000 6
C 0 $50,000 7
C $50,001 $100,000 8
C $100,001 $250,000 9
Thank you!
Two ways:
If the pattern is the same as to the breaks of the dollar amounts then use this:
=INDEX(D:D,MATCH(G1,A:A,0)+MATCH(H1,$B$1:$B$3)-1)
Where MATCH(G1,A:A,0) returns the first row where the ID is located and MATCH(H1,$B$1:$B$3) finds the relative location of the price in the first pattern. Change $B$1:$B$3 to encompass the whole pattern.
If the patterns are different then you can use this:
=SUMIFS(D:D,A:A,G1,B:B,"<=" & H1,C:C,">=" & H1)
One more for the future when Microsoft releases FILTER():
=FILTER(D:D,(A:A=G1)*(B:B<=H1)*(C:C>=H1))
This is entered normally and does not matter the pattern.

how to count number between certain range of rows?

i would like to count number for every 7 rows, data are in one column. i use this formula, but it is not working.
from B8 to B14329, for every 7 rows, count number if it is equal to 3. so i know how many 3 in every 7 rows.
=COUNTIFS(B8:B14329, OFFSET($B$7,(ROW()-12)*7,0,7,1),B8:B14329,=3)
Thanks a lot!
i want something like this:
data count
3
2
3
1
3
3
1 4
1
2
2
3
3
1
1 2
.....
....
...
Simple and easy:
=SUMPRODUCT((B8:B14329=3)*(MOD(ROW(B8:B14329),7)=1))
Just change the =1 to your needs. To start with row 1 =1, 2 =2 ... 6 =6, 7 =0. This way, to start count at row 8 it is =1
EDIT: having your exaple now, you want something completely different... lol.
=IF(MOD(ROW(),7)=0,COUNTIF(A8:A14,3),"")
Put this in row 14 and then drag down... change the =0 as you need it.
Here's what I would do
Add a new column with the row index (8 to 14239) in your case
Add Yet another column, with a formula to tell whether the column you just added is a multiple of 7. Put it's value like "TRUE" or "FALSE"
You can use the MOD function to check the remainder of the division.
= MOD ( Number , Divisor )
By now, you should have, aside from the columns you already have, something like:
8-----FALSE
9-----FALSE
10-----FALSE
11-----FALSE
12-----FALSE
13-----FALSE
14-----TRUE
15-----FALSE
Once you have that, just apply a filter on the "TRUE/FALSE" column, select the "TRUE" values and you will be able to count the number of "3"s on the actual value column, by also using a filter on it.
I hope it helps, and it's easier than a really messy formula.

Sum values if multiple conditions met in different sheet

I have one sheet that creates a mapping of names to values (Map_Sheet). In another sheet there are values for each name in the mapping table (Data_Sheet). What I am trying to do is add values based on certain conditions in the mapping table. For example: I want to add all counts of dog by bread and color. So in the mapping table I would look for all dogs that are brown and of a certain bread and get their names and manually add them together. I want to have a formula that does the addition based upon multiple conditions from Map_Sheet.
Here is an example of the data:
Map_Sheet-
name|bread|color|age
a x b 2
b y w 3
c x b 2
d z f 4
Data_Sheet -
id|a|b|c|d
0 3 4 2 1
1 1 2 4 2
2 3 5 7 2
3 1 2 6 9
4 1 3 5 7
And for each ID in the data sheet I want a count of bread X with color B. So I would add for ID0 values for A and C, (3+2) - so ID0 = 5, etc for each id.
I cannot use VBA so I was looking into using INDEX and MATCH but I cannot wrap my head around it. Any ideas? Thanks!
If the row headers in the first sheet match the column headers in the second sheet, you can put this formula in (say) G2 of the second sheet.
=SUM(TRANSPOSE(Map!$C$2:$C$5="b")*C2:F2)
If the column headers in the second sheet were in a different order, you would have to use something like:-
=SUM(C2:F2*NOT(ISERROR(MATCH($C$1:$F$1,IF(Map!$C$2:$C$5="b",Map!$A$2:$A$5),0))))
Both of these are array formulae. You can add extra conditions to select breed as well as colour using the same basic pattern:-
=SUM(TRANSPOSE((Map!$C$2:$C$5="b")*(Map!$B$2:$B$5="x"))*C2:F2)
or
=SUM(C2:F2*NOT(ISERROR(MATCH($C$1:$F$1,IF((Map!$C$2:$C$5="b")*(Map!$B$2:$B$5="x"),Map!$A$2:$A$5),0))))

Resources