Word multiplied by number to create a list.

nac1987

New Member
Joined
May 20, 2013
Messages
10
Hi there,
Funny one this... easy to explain, perhaps, yet a bit tricky when asked how to solve it! Can anyone help me?

I have 2 columns.

Column A is data, for example a name Nigel, Greg, Betty.
Columb B is a number, besides 'Nigel' will be 3, next to Greg, perhaps 2, Betty has a 5 next to her name, etc.

I want to have a list somewhere else that is being populated by writing out the long-hand version of this data, so it would write:

Nigel
Nigel
Nigel
Greg
Greg
Betty
Betty
Betty
Betty
Betty

With each name repeated by the number, and in a new cell, thanks to someone's previous help I have this sort of working (but I can't attach the file :( ), but now I'd like it to do the following... can anyone help adjust the formula?? :)

A) Can the formula be adjusted to not display a name at all if a zero is present next to a name?

And an even trickier one...

B) Within the list of names that grows, can there be pre-determined cells to skip?
For example if column D was the big list of names using your formula, could I have previously specified that D39 (and some other specified cells) must be skipped?
So that if I needed 5 x Graham, and it occupied D36, D37, D38, D40, and D41? Because I didn't want it to overwrite what I'd already written in D39.


Thank you so much to anyone that can help, in any way.
 
The data as you've written there, is correct.

I would like for column D to build a list of these names, exactly as the formula does!

Except I'd like to be able to add more names and numbers freely to column A & B.

The formula is constrained by the number of rows. If I change the formula to accept A2:B100 as you've given in your example, it won't work until I set all the values of column B to "0" instead of being just blank cells. It's not a problem I've had before, but I'm not an excel wizard!
 
Upvote 0

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
The data as you've written there, is correct.

I would like for column D to build a list of these names, exactly as the formula does!

Except I'd like to be able to add more names and numbers freely to column A & B.

The formula is constrained by the number of rows. If I change the formula to accept A2:B100 as you've given in your example, it won't work until I set all the values of column B to "0" instead of being just blank cells. It's not a problem I've had before, but I'm not an excel wizard!

I'm asking you what result from this data you want to obtain under what conditions? I'm not asking you anything about any formula!...
 
Upvote 0
I'm asking you what result from this data you want to obtain under what conditions? I'm not asking you anything about any formula!...

Apologies.

Here's what I'm trying to do.

1) have a data set as you've written, that is constantly expanding; more names, more numbers.
2) create a longer list of these names where Nigel-3, writes Nigel, Nigel, Nigel. and Betty-5 writes 'Betty' 5 times. If a name has a 0 beside it, I don't want that name to appear in this ever expanding list at all.

Following on from that, but that's already proving difficult...


3) I'd to have some pre-defined 'gaps' in the list. I think this is probably impossible. If the list of 5 Betty's occupies B4, B5, B6, B7, and B8, could I have said "insert a blank at B7" and then the Betty's would then occupy B4, B5, B6, B8 and B9.
4) Ultimately, I'd like to be able to draw some table-plans. Where Excel takes the long list of names, and organises them into some drawn out tables. Where I will draw a table in a 12x8 grid and then I can say 'the first 8 names in this column, the second 8 names in this column, etc... up to the 12th set of names in this column." - this is why I needed the blanks there. Because in the real-life physical tables, some places must be blank... There will be more names in the list than I can fit on a 12x8 grid, so I'll draw up several like that.

Does that give better scope to what I'm trying to achieve?
 
Upvote 0
It's getting harder to communicate.

Are we counfounding what is result and what is source? Did I post a result?
 
Upvote 0
If this is data...

Row\Col
A​
B​
1​
NAMEVALUE
2​
Nigel3
3​
Greg2
4​
Betty5
5​
Bill0
6​
Graham19
7​

in A2:B6, what result do you want obtain from it? Please state clearly the conditions under which the result must obtain.

ABCD
Nigel3Nigel
Betty2Nigel
Dave0Nigel
Bill2Betty
Betty
Bill
Bill

Column D is what I'm after. For now. :):)
 
Upvote 0
But it's not an array formula!!

Hi XOR LX,

Interested to know why you went for a non-array formula, which I see harnesses INDEX, and not something akin to this array version, which has less function calls:

Code:
=IF(ROWS(D$2:D2)>SUM(B$2:B$5),"",INDEX(A$2:A$5,MATCH(TRUE,MMULT((ROW(A$2:A$5)>=TRANSPOSE(ROW(A$2:A$5)))+0,B$2:B$5)>=ROWS(D$2:D2),0)))

Was there a reason for your choice?

Cheers,

Matty (Also in Yorkshire!)
 
Upvote 0
A
B
C
D
Nigel
3
Nigel
Betty
2
Nigel
Dave
Nigel
Bill
2
Betty
Betty
Bill
Bill

<tbody>
</tbody>

Column D is what I'm after. For now. :):)

A different take...

Row\Col
A​
B​
C​
D​
1​
NAMEVALUECUM
7​
2​
Nigel
3
3
#List#
3​
Betty
2
5
Nigel
4​
Dave
0
Nigel
5​
Bill
2
7
Nigel
6​
Betty
7​
Betty
8​
Bill
9​
Bill
10​

1) In C2 just enter and copy down:
Rich (BB code):



=IF($B2>0,SUM($B$2:B2),"")

2) Define Lrow by means of Formulas | Name Manager as referring to:
Rich (BB code):



=MATCH(9.99999999999999E+307,Sheet1!$B:$B)

3) Define Name as referring to:
Rich (BB code):



=Sheet1!$A$2:INDEX(Sheet1!$A:$A,Lrow)

4) Define Value as referring to:
Rich (BB code):



=Sheet1!$B$2:INDEX(Sheet1!$B:$B,Lrow)

5) Define Cum as referring to:
Rich (BB code):



=Sheet1!$C$2:INDEX(Sheet1!$C:$C,Lrow)

6) In D1 enter:
Rich (BB code):



=SUM(Sheet1!$B$2:$B$8)

7) In D3 control+shift+enter, not just enter, and copy down:
Rich (BB code):



=IF(ROWS($D$3:D3)<=$D$1,
  INDEX(Name,MATCH(1,IF(Cum>=ROWS($D$3:D3),
  IF(ROWS($D$3:D3)<=Cum,
  IF(ISNUMBER(1/Cum),1))),0)),"")
 
Last edited:
Upvote 0
Hi XOR LX,

Interested to know why you went for a non-array formula, which I see harnesses INDEX, and not something akin to this array version, which has less function calls:

Code:
=IF(ROWS(D$2:D2)>SUM(B$2:B$5),"",INDEX(A$2:A$5,MATCH(TRUE,MMULT((ROW(A$2:A$5)>=TRANSPOSE(ROW(A$2:A$5)))+0,B$2:B$5)>=ROWS(D$2:D2),0)))

Was there a reason for your choice?

No - is the answer!

To be honest I often veer more on the side of avoiding this method of inserting an additional INDEX function (actually here an N is required as well) for the sake of circumventing the need for CSE. In fact, I could perhaps be accused of being a touch hypocritical, since I've also made posts to the effect of advising people against this very practice.

Still, perhaps the occasional use is not such a bad thing: unless we're talking a huge number of iterations of that formula, the difference in performance shouldn't be too great between our two versions. And besides, perhaps some people might be interested to know that e.g. a construction containing TRANSPOSE does not necessarily require CSE.

Still, point taken, and I will probably try to avoid such practice from now on. "Avoidance" of array formulas is no doubt something that we should not be promoting; there's enough "fear" and misunderstanding of them as it is.

Cheers,

Matty (Also in Yorkshire!)

Good to know! :)
 
Upvote 0

Forum statistics

Threads
1,214,423
Messages
6,119,398
Members
448,892
Latest member
amjad24

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