Excel: Listing Numbers In Between 2 Numbers -


i wondering if knew of formula list numbers between 2 values, example if cell f2 had 12 in , g2 had 17 in i'd formula show 13,14,15,16 in cell h2.

thanks

this cannot done excel worksheet function. need vba that. can done user-defined function (udf).

the following code needs stored in code module. need right-click sheet tab, select view code. open visual basic editor. click insert > module , paste following code:

function inbetween(myfirst integer, mylast integer) dim foo string dim long foo = myfirst + 1 = myfirst + 2 mylast - 1     foo = foo & "," & next inbetween = foo end function 

now can use formula =inbetween(f2,g2) produce result describe.

you need save file macro-enabled workbook xlsm extension. see screenshot code , user defined function in action.

enter image description here


Comments