Complicated comparison between cells using LEN and....?

JBijl

New Member
Joined
Jun 10, 2010
Messages
25
Hi guys and ladies,

I have yet another question that I hope somebody here knows the answer to. I have the following situation:

A single Excel sheet with a total of 44 columns that contain content. The content is devided as follows:
A2 has text => B2 has LEN function to count the characters.
C2 has text => D2 has LEN function to count the characters.
E2 has text => F2 has LEN function to count the characters.
G2 has text => H2 has LEN function to count the characters.
I2 has text => J2 has LEN function to count the characters.
K2 has text => L2 has LEN function to count the characters.
etc...

In the last column I need to get the text that has the most characters from the prior cells. So if cell A2 has 120 characters, C2 has 125, E2 has 128, G2 has 103 etc... then in the last cell (AR2) would show the content of E2.

I know how to get the character counts per cell but is there a way to automate doing the compare between the different LEN results and then put the text from the cell with the highest result as actual text in the last cell?

Here is the link to the file https://www.dropbox.com/s/2jp5ie77vc4pdsq/Project 77 EN.xls. I hope you can work with it.

Thanks so much in advance for any help you all might be able to give.

Cheers
Jacob
 
Last edited:

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Based on your data, you can simply use the MAX function
Code:
=MAX(A2:AQ2)
 
Upvote 0
Try =lookup(max($b$2:$l$2),$b$2:$l$2,$a$2:$k$2)
 
Upvote 0
Hi Michael,

Thanks for your reply. Yes - your formula gives me the highest count in the row BUT what I really need is for the cell AR2 to give me the text that corresponds to the highest value in characters. So if cell AG2 shows that AF2 has 280 characters, then cell AR2 should show the text that is in AF2.

Hope that clarifies things.

Thank you for your help!!!
 
Upvote 0
Thanks but not sure how to use this
Copy and paste the formula into the cell where you want the longest text retrieved.
The sample I used goes up to column "L" to extend to "AR" use:

=lookup(max($b$2:$ar$2),$b$2:$ar$2,$a$2:$aq$2)

(just hit enter, its not an array formula)
 
Upvote 0
Copy and paste the formula into the cell where you want the longest text retrieved.
The sample I used goes up to column "L" to extend to "AR" use:

=lookup(max($b$2:$ar$2),$b$2:$ar$2,$a$2:$aq$2)

(just hit enter, its not an array formula)

Hi Teeroy,

Thanks for your help so far. I have tried, tested and played around with your formula but cant seem to get the correct outcome. It gives me the text of one of the cells in the AR-cell but it is not the highest count. And when I copy the formula down (have to remove the $-signs before the cell numbers) it seems to get confused.

What am I doing wrong?

Thanks again.
 
Upvote 0
It might be easier if I could look at the workbook. Can you put a copy of your workbook on a fileshare site (e.g. dropox) and post a hyperlink to it?
 
Upvote 0
Lookup won't work here, because it requires the data to be sorted Ascending, which it clearly is not..

Try

=INDEX($a$2:$aq$2,MATCH(MAX($b$2:$ar$2),$b$2:$ar$2,0))
 
Upvote 0

Forum statistics

Threads
1,215,332
Messages
6,124,314
Members
449,153
Latest member
JazzSingerNL

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top