ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   A new excel challenge (https://www.excelbanter.com/excel-programming/342724-new-excel-challenge.html)

Nick Danger

A new excel challenge
 
Hi folks,

I've run into a situation where I'm not sure what to do with it.

I have seven columns: A B C D F X and POP

beneath the letter colums are totals which can be of values 0 through
11.

What I ultimately want to do is have a formula in the pop cell
corresponding to each row of data which finds the maximum value and
shows the column name corresponding to it.

Following is an example of what I'd like POP to reflect based on
sample data:

A B C D F X POP
2 0 0 7 2 0 D
3 2 0 2 4 0 F
6 3 2 0 0 0 A

etc...

If anyone can give me an idea of which route to follow I'd appreciate
it.

Regards

Ben/ND

Tom Ogilvy

A new excel challenge
 
are the seven columns adjacent and these are labels found in row 1? So the
columns involved are A to G?

What about duplicate maximum values.

Looking for formula or macro?

--
Regards,
Tom Ogilvy

"Nick Danger" wrote in message
...
Hi folks,

I've run into a situation where I'm not sure what to do with it.

I have seven columns: A B C D F X and POP

beneath the letter colums are totals which can be of values 0 through
11.

What I ultimately want to do is have a formula in the pop cell
corresponding to each row of data which finds the maximum value and
shows the column name corresponding to it.

Following is an example of what I'd like POP to reflect based on
sample data:

A B C D F X POP
2 0 0 7 2 0 D
3 2 0 2 4 0 F
6 3 2 0 0 0 A

etc...

If anyone can give me an idea of which route to follow I'd appreciate
it.

Regards

Ben/ND




[email protected]

A new excel challenge
 
The following macro will do the job, or you could rewrite it as a user
defined function:

Sub FindMaxCol()
Const Alph As String = "ABCDFX" 'The column labels you gave
Dim MaxCol As Long 'The col with the highest value so far
Dim MaxVal As Long 'The highest value so far
Dim RowIndex As Long 'The row of the current cell
Dim ColIndex As Long 'The colimn of the current cell

For RowIndex = 2 To Range("A65536").End(xlUp).Row 'go from row 2 to
last row
MaxVal = 0 'Highest val found so far
MaxCol = 1 'Col of highest value
For ColIndex = 1 To 6 'Examine each cell in current row
If Cells(RowIndex, ColIndex) MaxVal Then
'Cell is max so far so save its value and col number
MaxVal = Cells(RowIndex, ColIndex)
MaxCol = ColIndex
End If
Next ColIndex 'Look at next col in this row
'Convert col number to col label & save it
Range("G" & RowIndex) = Mid(Alph, MaxCol, 1)
Next RowIndex 'Look at next row
End Sub



On Thu, 13 Oct 2005 13:20:05 -0400, Nick Danger
wrote:

Hi folks,

I've run into a situation where I'm not sure what to do with it.

I have seven columns: A B C D F X and POP

beneath the letter colums are totals which can be of values 0 through
11.

What I ultimately want to do is have a formula in the pop cell
corresponding to each row of data which finds the maximum value and
shows the column name corresponding to it.

Following is an example of what I'd like POP to reflect based on
sample data:

A B C D F X POP
2 0 0 7 2 0 D
3 2 0 2 4 0 F
6 3 2 0 0 0 A

etc...

If anyone can give me an idea of which route to follow I'd appreciate
it.

Regards

Ben/ND



Bob Phillips[_6_]

A new excel challenge
 
Nick,

Try this formula

=CHAR(MATCH(MAX(A2:F2),A2:F2,0)+64)

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Nick Danger" wrote in message
...
Hi folks,

I've run into a situation where I'm not sure what to do with it.

I have seven columns: A B C D F X and POP

beneath the letter colums are totals which can be of values 0 through
11.

What I ultimately want to do is have a formula in the pop cell
corresponding to each row of data which finds the maximum value and
shows the column name corresponding to it.

Following is an example of what I'd like POP to reflect based on
sample data:

A B C D F X POP
2 0 0 7 2 0 D
3 2 0 2 4 0 F
6 3 2 0 0 0 A

etc...

If anyone can give me an idea of which route to follow I'd appreciate
it.

Regards

Ben/ND





All times are GMT +1. The time now is 08:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com