Is it possible to store more than one number in a cell (i.e. an array in a cell), and how can the nth element be referenced in formulas?

Rnkhch

Well-known Member
Joined
Apr 28, 2018
Messages
578
Office Version
  1. 365
Platform
  1. Windows
Hello,

I'm wondering if it is possible to store more than one number in an array. I'm hoping I can reduce the size of my large score sheets by storing the scores of each student in one cell where for example the first element would be math score, the second physics score, the third chemistry score, etc., like this:

A1={98,83,87,90,93}

If this is possible, how would I reference the nth element in the cell to use in subsequent calculations?

Thanks a lot for any input!
 
Re: Is it possible to strore more than one number in a cell (i.e. an array in a cell), and how can the nth element be referenced in formulas?

This

Code:
=SUM(Math!A2,Physics!A2,Chemistry!A2,Language!A2,Arts!A2)
but another way is to put a blank sheet at the beginning called Start and another at the end called End, then just use
Code:
=SUM(START:END!A2)
 
Last edited:
Upvote 0

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Re: Is it possible to strore more than one number in a cell (i.e. an array in a cell), and how can the nth element be referenced in formulas?

you might want to transfer the helper column further out say column XFD (the furthest column)
This is a VERY bad idea, it will cause an immense amount of bloat & is liable to slow everything down big time.
 
Upvote 0
Re: Is it possible to strore more than one number in a cell (i.e. an array in a cell), and how can the nth element be referenced in formulas?

Wow, that's incredible! You're a genius jtakw

Now that this is taken care of, the next question is what would be the best way to put scores from multiple sheets into one cell? I tried something like this in "main" sheet and was hoping to drag the formula and easily compile the scores for all students in the main sheet, but it doesn't work:

A2=Math!A2,Physics!A2,Chemistry!A2,Language!A2,Arts!A2

Thanks a lot

Thanks, and you're welcome.

Try it like this:

=Math!A2&","&Physics!A2&","&Chemistry!A2&","&Language!A2&","&Arts!A2
 
Last edited:
Upvote 0
Re: Is it possible to strore more than one number in a cell (i.e. an array in a cell), and how can the nth element be referenced in formulas?

Hi,
[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: #DAE7F5"]
[TH="width: 10px"]Cell
[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: #DAE7F5"]D2
[/TH]
[TD="align: left"]=MID(SUBSTITUTE(A2,",",REPT(" ",30)),C2*30-29,30)+0[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]

Hello Jtakw

Your formula works perfectly. Nice job. I’m wondering if it can be adjusted so it would work on a series of letters instead of numbers. For example, if
A2 = AB,CD,E,FG,HIJ
C2 = 4
What would the formula in D2 be, so you would get ‘FG’ returned?

TotallyConfused
 
Upvote 0
Re: Is it possible to strore more than one number in a cell (i.e. an array in a cell), and how can the nth element be referenced in formulas?

Hello Jtakw

Your formula works perfectly. Nice job. I’m wondering if it can be adjusted so it would work on a series of letters instead of numbers. For example, if
A2 = AB,CD,E,FG,HIJ
C2 = 4
What would the formula in D2 be, so you would get ‘FG’ returned?

TotallyConfused

How long might the Text strings in between commas be?
If they won't be longer than 15 characters or so, then just drop the +0 at the end of my formula:


Book1
ABCD
1nth ElementResult
2AB,CD,E,FG,HIJ4FG
Sheet298
Cell Formulas
RangeFormula
D2=MID(SUBSTITUTE(A2,",",REPT(" ",30)),C2*30-29,30)
 
Upvote 0
Re: Is it possible to strore more than one number in a cell (i.e. an array in a cell), and how can the nth element be referenced in formulas?

How long might the Text strings in between commas be?
If they won't be longer than 15 characters or so, then just drop the +0 at the end of my formula:

ABCD
nth ElementResult
AB,CD,E,FG,HIJ FG

<tbody>
[TD="align: center"]1[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]2[/TD]

[TD="align: right"][/TD]
[TD="align: right"]4[/TD]

</tbody>
Sheet298

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<tbody>[TR]
[TH]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
[TR]
[TH]D2[/TH]
[TD="align: left"]=MID(SUBSTITUTE(A2,",",REPT(" ",30)),C2*30-29,30)[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
Hello Jtakw

Thank you for your quick and complete response to my question. As far as answering your question about how long each text string would be between commas, I can’t answer that. I don’t have a specific problem I’m working on. I’ve been following this thread and after seeing your formula for selecting numbers, it occurred to me to wonder how to select text, which prompted my question.

I understand how the command of MID works, but I’m trying to figure out SUBSTITUTE and REPT, especially how they work together here. I played with your formula by changing the numbers, and found it still seemed to work as long as I kept the same relationship between the ‘30’ and ‘29’.

1 ) Is there any reason you picked ‘30’ rather than some other number?
2 ) If there were more than 15 characters, how would that change your formula? E.g. 20 or 30 characters.

Again, I want to THANK YOU for your help. This site has been a gold mine of help and information to beginners like me, and it is people like you that have made all this possible. In case you’re wondering about my name, yes, I’m still totally confused. It seems the more I learn about Excel and VBA, the more confused I become. Is there any hope for me? :)

TotallyConfused
 
Last edited:
Upvote 0
Re: Is it possible to strore more than one number in a cell (i.e. an array in a cell), and how can the nth element be referenced in formulas?

@TOTALLY confused...:beerchug:

See my tagline
 
Last edited:
Upvote 0
Re: Is it possible to strore more than one number in a cell (i.e. an array in a cell), and how can the nth element be referenced in formulas?

@TOTALLY confused...:beerchug:

See my tagline
Hello Michael

Thanks for the offer. Normally, I’m not a drinker, but there have been times while working with Excel and VBA I’ve wondered whether I should start. I don’t think I’ll ever master all this, and now this past week I’ve heard that Microsoft has introduced seven new commands. Just what I need – more things to try to cram into my overworked brain.

TotallyConfused
 
Upvote 0
Re: Is it possible to strore more than one number in a cell (i.e. an array in a cell), and how can the nth element be referenced in formulas?

Thanks!

And excellent discussion. I learned so much through this thread :)
 
Upvote 0
Re: Is it possible to strore more than one number in a cell (i.e. an array in a cell), and how can the nth element be referenced in formulas?

@ TotallyConfused
If you're an Edmonton Eskimo fan you'll start drinking after today's game!
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,306
Members
452,633
Latest member
DougMo

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