MC

MC(cell001,[cell002], [cell003], [cell004], [cell005],[cell006],[cell007],[cell008],[cell009],[cell010],[cell011],[cell012],[cell013],[cell014],[cell015],[cell016],[cell017],[cell018],[cell019],[cell020])
cell001
required
cell002, etc.
optional

MC allows for conveniently selecting multiple discontinuous cells as a single parameter within the syntax of formulas

Rnkhch

Well-known Member
Joined
Apr 28, 2018
Messages
578
Office Version
  1. 365
Platform
  1. Windows
MC allows for conveniently selecting multiple discontinuous cells as a single parameter within the syntax of formulas

MC stands for "multiple cells". Many functions allow for selecting one cell or a continuous range of cells, and attempting to select multiple discontinuous cells through commas or {} results in syntax error. MC allows for selecting multiple discontinuous cells without verbose coding. Thus the code remains concise and almost identical to the functions intended syntax/parametric structure. The result of the MC function is a spill which is identical in size to the number of supplied cells. MC faithfully reproduces all types of data including, numbers, texts, errors, formula blanks, and real blanks. I have set the max number of supplied cells to 20, but this can be easily increased to the desired number.

For instance, supplying five discontinuous cells to the ISNUMBER() function can easily be done as ISNUMBER(MC(A1,C8,G12,H18,K4))

Excel Formula:
=LAMBDA(cell001,[cell002],[cell003],[cell004],[cell005],[cell006],[cell007],[cell008],[cell009],[cell010],[cell011],[cell012],[cell013],[cell014],[cell015],[cell016],[cell017],[cell018],[cell019],[cell020],
    LET(
        s,SEQUENCE(20-IO(cell002)-IO(cell003)-IO(cell004)-IO(cell005)-IO(cell006)-IO(cell007)-IO(cell008)-IO(cell009)-IO(cell010)-IO(cell011)-IO(cell012)-IO(cell013)-IO(cell014)-IO(cell015)-IO(cell016)-IO(cell017)-IO(cell018)-IO(cell019)-IO(cell020)),
        x,CHOOSE(s,IB(cell001),IB(cell002),IB(cell003),IB(cell004),IB(cell005),IB(cell006),IB(cell007),IB(cell008),IB(cell009),IB(cell010),IB(cell011),IB(cell012),IB(cell013),IB(cell014),IB(cell015),IB(cell016),IB(cell017),IB(cell018),IB(cell019),IB(cell020)),
        x
    )
)

In this code, I have used two simple additional LAMBDAs to keep the syntax of MP more concise and clean:
Excel Formula:
IO=LAMBDA(cell,ISOMITTED(cell))
Excel Formula:
IB=LAMBDA(cell,IF(ISBLANK(cell),"",cell))

Book1
ABCDEFGH
1Original cellsMC spillISNUMBER with MC
242.98642.986TRUE
3aaFALSE
4FALSE
5#N/A#N/AFALSE
6 FALSE
7#DIV/0!#DIV/0!FALSE
8Hi!Hi!FALSE
9
10
11
12
Sheet1
Cell Formulas
RangeFormula
C2:C8C2=MC(B2,B3,B4,B5,B6,B7,B8)
D2:D8D2=ISNUMBER(MC(B2,B3,B4,B5,B6,B7,B8))
B5B5=LOOKUP(F2,F3:F4)
B6B6=IF(ISNUMBER(A1),1,"")
B7B7=2.784/0
Dynamic array formulas.


Please feel free to share any thoughts or suggestions.

This work is primarily done by Jason (jasonb75), and the discussion can be found at the following thread:
 
Last edited by a moderator:
Upvote 0

Forum statistics

Threads
1,223,883
Messages
6,175,167
Members
452,615
Latest member
bogeys2birdies

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