LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #12   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default How to repeat one cell specific times to form an array?

I think we are getting ourselves all tied up in a knot here

We can blame the OP! <VVBG

Biff

"Roger Govier" wrote in message
...
Hi Biff
I think we are getting ourselves all tied up in a knot here, all through a
mistake on my part and I fully apologise.

I can now see that formula wrapping, when I pasted your solution into my
spreadsheet, caused your formula to retain the trailing comma and space,
and I can also *now* see that was what Bob was pointing out in his post.

On my machine, with both your original formula and mine, I get {100, 100,
100, }
So, your formula did not *appear* to be "cleaning up". I posted an
amendment to mine
=IF(COUNTA(A1:B1)<2,"","{"&REPT(A1&", ",B1-1)&A1&"}")
which does produce what the OP requested {100, 100, 100} (and is still
somewhat shorter<bg)

I had mistakenly thought that Bob was suggesting my formula needed a
trailing space (sorry Bob), and posted (with knowledge of the OP's
subsequent posting) that spaces were superfluous.

My final offering to the OP still did retain the first 2 spaces, but for
the NPV formula it makes no difference to the array whether they are
included or not.

Once again, apologies for the confusion caused.
--
Regards

Roger Govier


"T. Valko" wrote in message
...
I guess we just have a different interpretation of what the OP originally
asked for.

I want to put in C1 an array like this :{100, 100, 100}


The OP's original request was for {100, 100, 100}
without any trailing commas or spaces.
Your formula did leave trailing comma and space.


That's *exactly* what the OP asked for: {100, 100, 100}

I see a trailing comma and space after each element except the last. So
the formula I suggested did just that. Unless the request is for
something that is obviously incorrect or terribly inefficient I try to
give 'em exactly what they ask for. If that turns out to be inappropriate
or they discover that it didn't do what they had expected then that
usually will generate follow-ups in which we can refine things. This
thread is a perfect example of that!

Biff

"Roger Govier" wrote in message
...
Hi Biff

I wasn't trying to be derogatory about your use of the space, merely
pointing out that it wasn't necessary.
The OP's original request was for {100, 100, 100}
without any trailing commas or spaces.
Your formula did leave trailing comma and space.

As you rightly guessed, they wanted to use it as an array in another
formula, which works equally well, with or without spaces.

Certainly no offence intended on my part.
--
Regards

Roger Govier


"T. Valko" wrote in message
...
the space is actually superfluous.

Yes, in the final analysis after we found out what the OP was really up
to. But, it answered the original question as posed.

Biff

"Roger Govier" wrote in message
...
Yes, Bob, but the space is actually superfluous.
I would change the ", " to ","

--
Regards

Roger Govier


"Bob Phillips" wrote in message
...
Note that Biff's formula uses ", " throughout Roger, with a comma
space.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Roger Govier" wrote in message
...
Hi Biff
I get {100, 100, 100, } with both formulae

If, as you say the OP wants to use it as part of another formula,
then
=IF(COUNTA(A1:B1)<2,"","{"&REPT(A1&", ",B1-1)&A1&"}")
seems to sort it out.

--
Regards

Roger Govier


"T. Valko" wrote in message
...
That last part:

LEN(REPT(A1&", ",B1))-2)

Is being used to "clean-up". Without it, you get:

{100, 100, 100, }

With it, you get:

{100, 100, 100}

I'm wondering if the OP is trying to use this in another formula?

Biff

"Roger Govier" wrote in message
...
Hi Biff

Couldn't that be shortened to
=IF(COUNTA(A1:B1)<2,"","{"&REPT(A1&", ",B1)&"}")

--
Regards

Roger Govier


"T. Valko" wrote in message
...
Try this:

=IF(COUNTA(A1:B1)<2,"","{"&LEFT(REPT(A1&", ",B1),LEN(REPT(A1&",
",B1))-2)&"}")

Biff

"liups" wrote in message
ups.com...
Hi,
I need to repeat the content of a cell to form an array, like
this:
A1: 100
B1: 3
I want to put in C1 an array like this :{100, 100, 100}, but I
don't
know how to write the formula, any ideas?

thank you very much.























 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
repeat cell values into other cells x times Abi L Excel Discussion (Misc queries) 0 April 17th 07 12:02 PM
Count the number of times a cell value is within a specific range Everett Excel Worksheet Functions 4 September 2nd 06 10:54 PM
Using an Excel VB-made form in cell-specific conditions. David P. A. Hunter, esq. III Excel Worksheet Functions 2 July 20th 06 03:25 AM
How to return the row # of an expression in specific array of cell Rado Excel Worksheet Functions 2 June 27th 06 04:59 PM
Counting the number of times a specific character appears in a cell PCLIVE Excel Worksheet Functions 3 November 4th 05 05:08 AM


All times are GMT +1. The time now is 04:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"