Home

ROW(), INDIRECT() & MID() functions - syntax and result (help)

%3CLINGO-SUB%20id%3D%22lingo-sub-263348%22%20slang%3D%22en-US%22%3EROW()%2C%20INDIRECT()%20%26amp%3B%20MID()%20functions%20-%20syntax%20and%20result%20(help)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-263348%22%20slang%3D%22en-US%22%3E%3CP%3E%3CEM%3EHello%20everybody!%20%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3EMy%20name%E2%80%99s%20FC%2C%20I%E2%80%99m%2036%20and%20I%E2%80%99m%20from%20Italy.%20%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3EBy%20%22sifting%22%20on-line%20I%20found%20solution%20to%20several%20of%20my%20questions%2C%20often%20just%20doing%20%22copy%20%26amp%3B%20paste%22%20and%20trying%20...%26nbsp%3B%3C%2FEM%3E%3CEM%3EI%20wish%20I%20wouldn%E2%80%99t%20limit%20myself%20to%20this%2C%20so%20I%E2%80%99m%20looking%20for%20suggestion%2F%20support%20about%20the%20functions%20in%20object%2C%20to%20go%20deeper%20and%20better%20understand%20their%20behavior.%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3EROW()%20function%3C%2FSTRONG%3E%3CBR%20%2F%3ELet%E2%80%99s%20suppose%20we%20have%20the%20following%20values%3A%20A1%20%3D%201%20and%20B1%20%3D%205%3B%20if%20I%20write%20in%20D1%20%7B%3D%20ROW(A1%3A%20B1)%7D%20and%20then%20I%20press%20F9%20I%20get%20%7B1%7D%2C%20while%20if%20always%20in%20D1%20I%20write%20%7B%3D%20ROW(1%3A%205)%7D%20pressing%20F9%20I%20get%20%7B1.2.3.4.5%20%7D.%3CBR%20%2F%3Ept.%201%20-%20why%3F%20(what%E2%80%99s%20the%20difference)%3CBR%20%2F%3Ept.%202%20-%20what%20makes%20ROW()%20acting%20this%20way%20(i.e.%20essentially%20create%20a%20vector)%3F%20What%E2%80%99s%20%E2%80%9Cbehind%E2%80%9D%20that%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3EINDIRECT()%20function%3C%2FSTRONG%3E%3CBR%20%2F%3ELet%E2%80%99s%20get%20back%20to%20the%20starting%20data%20above%3A%20A1%20%3D%201%20and%20B1%20%3D%205%3B%20if%20I%20write%20in%20D1%20%7B%3D%20INDIRECT%20(1%3A%205)%7D%20I%20get%20%23REF%20!%2C%20while%20if%20I%20always%20write%20in%20D1%20%7B%3D%20INDIRECT%20(A1%20%26amp%3B%20%22%3A%22%20%26amp%3B%20B1)%7D%20by%20pressing%20F9%20it%20appears%20%22%20The%20formula%20is%20too%20long%20formulas%20should%20not%20be%20longer%20than%208192%20characters%20%22%E2%80%A6%20what%E2%80%99s%20that%3F!%3F%3CBR%20%2F%3EBut%20if%20I%20finally%20write%20in%20D1%20%7B%3D%20ROW(INDIRECT%20(A1%20%26amp%3B%20%22%3A%22%20%26amp%3B%20B1))%7D%20I%20get%20%7B1.2.3.4.5%7D.%3CBR%20%2F%3Ethe%20questions%20are%20always%20the%20same%3A%20why%20and%20what%20makes%20INDIRECT()%20acting%20this%20way%20(%3F).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3EMID()%20function%3C%2FSTRONG%3E%3CBR%20%2F%3ELast%20question%2C%20this%20time%20for%20simplicity%20let%E2%80%99s%20write%20in%20D1%20the%20formula%20%7B%3D%20MID(%22BOB%22%3B%20ROW(1%3A%209)%3B%201)%7D%20that%20by%20pressing%20F9%20returns%20%7B%22B%22.%20%22O%22.%20%22B%22.%22.%22.%22.%22.%22.%22.%22%7D%3B%20also%20in%20this%20case%2C%20why%20and%20what%20makes%20MID()%20acting%20this%20way%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CEM%3Ethanks%20a%20lot%20everyone!%3C%2FEM%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-263348%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-305776%22%20slang%3D%22en-US%22%3ERe%3A%20ROW()%2C%20INDIRECT()%20%26amp%3B%20MID()%20functions%20-%20syntax%20and%20result%20(help)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-305776%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EINDIRECT%20returns%20the%20reference%20specified%20in%20the%20text.%20If%20you%20take%20%3DINDIRECT(%22A1%22)%20that%20will%20be%20converted%20to%20%3DA1%20and%20result%20is%20%22T%22.%3C%2FP%3E%0A%3CP%3EIf%20%3DINDIRECT(A1)%20it%20takes%20the%20text%20from%20A1%2C%20converts%20to%20%3DT%2C%20that's%20wrong%20reference%20and%20result%20is%20%23REF%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-305146%22%20slang%3D%22en-US%22%3ERe%3A%20ROW()%2C%20INDIRECT()%20%26amp%3B%20MID()%20functions%20-%20syntax%20and%20result%20(help)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-305146%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%20i%20have%20a%20similar%20problem%20in%20my%20case%20i%20dont%20understand%20the%20indirect%20function%20too%20well.%3C%2FP%3E%3CP%3EIf%20i%20put%20in%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EA1%3DT%3C%2FP%3E%3CP%3EB1%3D2%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAnd%20the%20indirect%20function%20in%20the%20cell%3C%2FP%3E%3CP%3EC3%20%3D%20Indirect(A1)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20result%20should%20be%20C3%20%3D%202%2C%20but%20all%20i%20have%20is%20a%20error%20%23Ref%3C%2FP%3E%3CP%3EAnd%20it%20says%20that%20the%20celd%20is%20not%20valid%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20you%20could%20help%20it%20would%20be%20great.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-263635%22%20slang%3D%22en-US%22%3ERe%3A%20ROW()%2C%20INDIRECT()%20%26amp%3B%20MID()%20functions%20-%20syntax%20and%20result%20(help)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-263635%22%20slang%3D%22en-US%22%3Ethnx%20a%20lot%20Detlef%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-263549%22%20slang%3D%22en-US%22%3ERe%3A%20ROW()%2C%20INDIRECT()%20%26amp%3B%20MID()%20functions%20-%20syntax%20and%20result%20(help)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-263549%22%20slang%3D%22en-US%22%3E%3CP%3EFrancesco%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Elet%20me%20explain%20the%20combination%20of%20ROW()%20and%20INDIRECT().%3C%2FP%3E%3CP%3EFirst%20ROW()%20expects%20a%20single%20cell%20reference%20and%20spits%20out%20a%20single%20value.%20If%20you%20need%20an%20array%20of%20values%20you%20have%20use%20an%20array%20in%20the%20function.%3C%2FP%3E%3CP%3EROW(A1)%20%3D%201%3C%2FP%3E%3CP%3EROW(A1%3AA5)%20%3D%26nbsp%3B%3CSPAN%3E%7B1.2.3.4.5%7D%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EROW(1%3A5)%20%3D%26nbsp%3B%7B1.2.3.4.5%7D%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EThe%20column%20letters%20can%20be%20left%20out%20or%20changed%20to%20any%20other%20column%20letter.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EIf%20you%20want%20it%20dynamic%20and%20use%20two%20cells%20for%20the%20lower%20and%20upper%20values%20the%20formula%20would%20be%3A%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EROW(INDIRECT(A1%26amp%3B%22%3A%22%26amp%3BB1))%20%3D%26nbsp%3B%7B1.2.3.4.5%7D%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EWhere%20INDIRECT()%20transforms%20a%20%3CU%3Etext%3C%2FU%3E%20in%20a%20cell%2Farray%20%3CU%3Ereference%3C%2FU%3E.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EAnd%20as%20for%20MID()%2C%20i%3C%2FSPAN%3Ef%20you%20want%20more%20characters%20to%20extract%20from%20a%20text%20than%20the%20length%20of%20the%20text%20MID()%20is%20polite%20and%20returns%20a%20blank%20text%20value%20for%20the%20%22non-existing%22%20parts.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Francesco Carmellini
New Contributor

Hello everybody!
My name’s FC, I’m 36 and I’m from Italy.
By "sifting" on-line I found solution to several of my questions, often just doing "copy & paste" and trying ... I wish I wouldn’t limit myself to this, so I’m looking for suggestion/ support about the functions in object, to go deeper and better understand their behavior.

 

ROW() function
Let’s suppose we have the following values: A1 = 1 and B1 = 5; if I write in D1 {= ROW(A1: B1)} and then I press F9 I get {1}, while if always in D1 I write {= ROW(1: 5)} pressing F9 I get {1.2.3.4.5 }.
pt. 1 - why? (what’s the difference)
pt. 2 - what makes ROW() acting this way (i.e. essentially create a vector)? What’s “behind” that?

 

INDIRECT() function
Let’s get back to the starting data above: A1 = 1 and B1 = 5; if I write in D1 {= INDIRECT (1: 5)} I get #REF !, while if I always write in D1 {= INDIRECT (A1 & ":" & B1)} by pressing F9 it appears " The formula is too long formulas should not be longer than 8192 characters "… what’s that?!?
But if I finally write in D1 {= ROW(INDIRECT (A1 & ":" & B1))} I get {1.2.3.4.5}.
the questions are always the same: why and what makes INDIRECT() acting this way (?).

 

MID() function
Last question, this time for simplicity let’s write in D1 the formula {= MID("BOB"; ROW(1: 9); 1)} that by pressing F9 returns {"B". "O". "B"."."."."."."."}; also in this case, why and what makes MID() acting this way?

 

thanks a lot everyone! 

4 Replies

Francesco,

 

let me explain the combination of ROW() and INDIRECT().

First ROW() expects a single cell reference and spits out a single value. If you need an array of values you have use an array in the function.

ROW(A1) = 1

ROW(A1:A5) = {1.2.3.4.5}

ROW(1:5) = {1.2.3.4.5}

The column letters can be left out or changed to any other column letter.

 

If you want it dynamic and use two cells for the lower and upper values the formula would be:

ROW(INDIRECT(A1&":"&B1)) = {1.2.3.4.5}

Where INDIRECT() transforms a text in a cell/array reference.

 

And as for MID(), if you want more characters to extract from a text than the length of the text MID() is polite and returns a blank text value for the "non-existing" parts.

 

Hi, i have a similar problem in my case i dont understand the indirect function too well.

If i put in 

 

A1=T

B1=2

 

And the indirect function in the cell

C3 = Indirect(A1)

 

The result should be C3 = 2, but all i have is a error #Ref

And it says that the celd is not valid

 

If you could help it would be great.

 

Hi,

 

INDIRECT returns the reference specified in the text. If you take =INDIRECT("A1") that will be converted to =A1 and result is "T".

If =INDIRECT(A1) it takes the text from A1, converts to =T, that's wrong reference and result is #REF

Related Conversations
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
flashing a white screen while open new tab
cntvertex in Discussions on
13 Replies
Tabs and Dark Mode
cjc2112 in Discussions on
22 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
28 Replies
Edge insider Dev bypasses IE mode website list
HotCakeX in Enterprise on
4 Replies