MAX applied to dynamic array

excelos

Well-known Member
Joined
Sep 25, 2011
Messages
591
Office Version
  1. 365
Platform
  1. Windows
Hello

Do you know any neat way to apply a MAX in an array?
I.e. MAX({0,3},2) will return 3
While, I wanted to return {2,3} i.e. to compare each of the {0,3} vs 2 and return the resulted array.

It would be great to do the same with substituting text, i.e. replace b with e in each of the {abc,bcd} to return {aec,ecd}

I think both the above kind of represent a more general concept: how to perform actions on each of the components of an array with a constant value without having to repeat the constant value to create an equally long array.

Thanks!
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Have you tried the second one?

=SUBSTITUTE({"abc","bcd"},"b","e") works fine.

Functions like MAX, AVERAGE, SUM etc will collapse the array to a single value, so you'll need a workaround, e.g.

=LET(n,{0,3,9,-1,2,22,5,1},IF(n>2,n,2))
 
Upvote 0

Forum statistics

Threads
1,215,743
Messages
6,126,608
Members
449,321
Latest member
syzer

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