Find longest String in Range, and Reflect in Cell

ECUPIRATE

New Member
Joined
Jun 13, 2017
Messages
25
Hi!

I am trying to make a formula where the longest word in a range from a different worksheet, is reflected in the same cell where I create the formula.

For example,

Cell A4 should have the formula
and the Range would be located in a Worksheet labeled Descriptions
Cell A4 would show the longest word, with a successful formula

I can't seem to get the follow array formula to work:
=CELL("",INDEX(Descriptions!A3:D3,MATCH(MAX(LEN(Descriptions!A3:D3)),LEN(Descriptions!A3:D3),0)))

I'm hoping to not have to use it, maybe there is a better way?
Please help.
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Thank you!! That worked - I thought if I put an IF function with it, it would work, but it's not:

=IF(D3="x",INDEX(Descriptions!A3:D3,MATCH(MAX(A3:D3)),LENA3:D3),0)),D3)

...If I could just get this right, my worksheet would work- Then I can go home, and sleep lol. I feel like I'm close. Have any ideas?
 
Upvote 0
Thank you!! That worked - I thought if I put an IF function with it, it would work, but it's not:

=IF(D3="x",INDEX(Descriptions!A3:D3,MATCH(MAX(A3:D3)),LENA3:D3),0)),D3)

...If I could just get this right, my worksheet would work- Then I can go home, and sleep lol. I feel like I'm close. Have any ideas?

What is your intent? If D3 = x, do the suggested INDEX formula, otherwise return D3? If so, apply control+shift+enter to the formula you extended.
 
Upvote 0
Thank you!! That worked - I thought if I put an IF function with it, it would work, but it's not:

=IF(D3="x",INDEX(Descriptions!A3:D3,MATCH(MAX(A3:D3)),LENA3:D3),0)),D3)

...If I could just get this right, my worksheet would work- Then I can go home, and sleep lol. I feel like I'm close. Have any ideas?

I am trying to have it where if I place an x in cell D3, the longest word will show. But if there is no x is cell D3, then nothing would show.
 
Upvote 0
I am trying to have it where if I place an x in cell D3, the longest word will show. But if there is no x is cell D3, then nothing would show
 
Upvote 0
You can't have a manual entry in a cell and a formula in that cell at the same time...

Thanks for your help - I will clarify -> I mean if there is already an x is cell D3, I would like for the array formula to spit out the longest word, otherwise, whatever is in cell D3 would should show
 
Upvote 0
Thanks for your help - I will clarify -> I mean if there is already an x is cell D3, I would like for the array formula to spit out the longest word, otherwise, whatever is in cell D3 would should show

Control+shift+enter, not just enter:

=IF(D3="x",INDEX(Descriptions!A3:D3,MATCH(MAX(A3:D3)),LENA3:D3),0)),D3)
 
Upvote 0

Forum statistics

Threads
1,223,098
Messages
6,170,100
Members
452,301
Latest member
QualityAssurance

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