Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Would I use "Lookup" to pick names for a Christmas grab bag

Hi,

I am trying to create (what I thought was a small project) a Christmas Grab
Bag, sort of speak. A person would type in his/her name and then the computer
would randomly pick out one name of the people in the grab bag. I am trying
to use vlookup but I don't know how to have the computer only pick the name
once, with out using his/her own name. Does anyone have any ideas???? Below
is an example of what I am trying to do.

Joe
Mary
Bob
Jane
Enter your name: Joe
You Have: Bob

Is this way beyond something for excel??? It's way beyond me. I thought it
would work but I can't seem to find any functions to make this turn out.

Can someone please help?????





  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Would I use "Lookup" to pick names for a Christmas grab bag

Here's one way...

Assume you have 20 names in the range A1:A20.

Enter this formula in B1 and copy down to B20:

=RAND()

Enter this formula in D1 and copy over to E1:

=INDEX($A:$A,MATCH(SMALL($B$1:$B$20,ROWS($1:1)+(CO LUMNS($A:A)-1)*10),$B$1:$B$20,0))

Select both D1 and E1 and copy down to row 10.

This will give you 10 random pairs of names.

Anytime the file recalculates you'll get a new "shuffle" of names. Once you
get the mix and are satisfied convert the formulas in D1:E10 to constants
and they won't shuffle anymore.

Select the range D1:E10
Goto the menu EditCopy
Then, EditPaste SpecialValuesOK

--
Biff
Microsoft Excel MVP


"Doebaby" wrote in message
...
Hi,

I am trying to create (what I thought was a small project) a Christmas
Grab
Bag, sort of speak. A person would type in his/her name and then the
computer
would randomly pick out one name of the people in the grab bag. I am
trying
to use vlookup but I don't know how to have the computer only pick the
name
once, with out using his/her own name. Does anyone have any ideas????
Below
is an example of what I am trying to do.

Joe
Mary
Bob
Jane
Enter your name: Joe
You Have: Bob

Is this way beyond something for excel??? It's way beyond me. I thought it
would work but I can't seem to find any functions to make this turn out.

Can someone please help?????







  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Would I use "Lookup" to pick names for a Christmas grab bag

Thank You T.Valko your formula worked like a charm but is there any way of
having each person come to the computer and type in his/her own name to get
the response. We are a small office of 10 people and we can do it the old
fashion way of drawing names out of a hat but I had this brillant idea of
using the comuter instead. So while your formula works great, how do I
seperated it out so that each person can type in his/her name, in a cell and
in the next cell appear a new name (which would be the person whom they buy a
gift for)

Can it be done this way?????


"T. Valko" wrote:

Here's one way...

Assume you have 20 names in the range A1:A20.

Enter this formula in B1 and copy down to B20:

=RAND()

Enter this formula in D1 and copy over to E1:

=INDEX($A:$A,MATCH(SMALL($B$1:$B$20,ROWS($1:1)+(CO LUMNS($A:A)-1)*10),$B$1:$B$20,0))

Select both D1 and E1 and copy down to row 10.

This will give you 10 random pairs of names.

Anytime the file recalculates you'll get a new "shuffle" of names. Once you
get the mix and are satisfied convert the formulas in D1:E10 to constants
and they won't shuffle anymore.

Select the range D1:E10
Goto the menu EditCopy
Then, EditPaste SpecialValuesOK

--
Biff
Microsoft Excel MVP


"Doebaby" wrote in message
...
Hi,

I am trying to create (what I thought was a small project) a Christmas
Grab
Bag, sort of speak. A person would type in his/her name and then the
computer
would randomly pick out one name of the people in the grab bag. I am
trying
to use vlookup but I don't know how to have the computer only pick the
name
once, with out using his/her own name. Does anyone have any ideas????
Below
is an example of what I am trying to do.

Joe
Mary
Bob
Jane
Enter your name: Joe
You Have: Bob

Is this way beyond something for excel??? It's way beyond me. I thought it
would work but I can't seem to find any functions to make this turn out.

Can someone please help?????








  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Would I use "Lookup" to pick names for a Christmas grab bag

Can it be done this way?????

Probably, but it'll be more complicated than what I suggested already. And,
doing it that way it's not truly random. If you have 10 people then only 5
of them get to enter their name. So, now you have to have some process to
see who gets to enter their name! <g

Let me see what I can come up with.


--
Biff
Microsoft Excel MVP


"Doebaby" wrote in message
...
Thank You T.Valko your formula worked like a charm but is there any way
of
having each person come to the computer and type in his/her own name to
get
the response. We are a small office of 10 people and we can do it the old
fashion way of drawing names out of a hat but I had this brillant idea of
using the comuter instead. So while your formula works great, how do I
seperated it out so that each person can type in his/her name, in a cell
and
in the next cell appear a new name (which would be the person whom they
buy a
gift for)

Can it be done this way?????


"T. Valko" wrote:

Here's one way...

Assume you have 20 names in the range A1:A20.

Enter this formula in B1 and copy down to B20:

=RAND()

Enter this formula in D1 and copy over to E1:

=INDEX($A:$A,MATCH(SMALL($B$1:$B$20,ROWS($1:1)+(CO LUMNS($A:A)-1)*10),$B$1:$B$20,0))

Select both D1 and E1 and copy down to row 10.

This will give you 10 random pairs of names.

Anytime the file recalculates you'll get a new "shuffle" of names. Once
you
get the mix and are satisfied convert the formulas in D1:E10 to constants
and they won't shuffle anymore.

Select the range D1:E10
Goto the menu EditCopy
Then, EditPaste SpecialValuesOK

--
Biff
Microsoft Excel MVP


"Doebaby" wrote in message
...
Hi,

I am trying to create (what I thought was a small project) a Christmas
Grab
Bag, sort of speak. A person would type in his/her name and then the
computer
would randomly pick out one name of the people in the grab bag. I am
trying
to use vlookup but I don't know how to have the computer only pick the
name
once, with out using his/her own name. Does anyone have any ideas????
Below
is an example of what I am trying to do.

Joe
Mary
Bob
Jane
Enter your name: Joe
You Have: Bob

Is this way beyond something for excel??? It's way beyond me. I thought
it
would work but I can't seem to find any functions to make this turn
out.

Can someone please help?????










  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Would I use "Lookup" to pick names for a Christmas grab bag

Okay, I really appreciate the time you are taking in helping me. I will wait
and check back. Thank you again :)

"T. Valko" wrote:

Can it be done this way?????


Probably, but it'll be more complicated than what I suggested already. And,
doing it that way it's not truly random. If you have 10 people then only 5
of them get to enter their name. So, now you have to have some process to
see who gets to enter their name! <g

Let me see what I can come up with.


--
Biff
Microsoft Excel MVP


"Doebaby" wrote in message
...
Thank You T.Valko your formula worked like a charm but is there any way
of
having each person come to the computer and type in his/her own name to
get
the response. We are a small office of 10 people and we can do it the old
fashion way of drawing names out of a hat but I had this brillant idea of
using the comuter instead. So while your formula works great, how do I
seperated it out so that each person can type in his/her name, in a cell
and
in the next cell appear a new name (which would be the person whom they
buy a
gift for)

Can it be done this way?????


"T. Valko" wrote:

Here's one way...

Assume you have 20 names in the range A1:A20.

Enter this formula in B1 and copy down to B20:

=RAND()

Enter this formula in D1 and copy over to E1:

=INDEX($A:$A,MATCH(SMALL($B$1:$B$20,ROWS($1:1)+(CO LUMNS($A:A)-1)*10),$B$1:$B$20,0))

Select both D1 and E1 and copy down to row 10.

This will give you 10 random pairs of names.

Anytime the file recalculates you'll get a new "shuffle" of names. Once
you
get the mix and are satisfied convert the formulas in D1:E10 to constants
and they won't shuffle anymore.

Select the range D1:E10
Goto the menu EditCopy
Then, EditPaste SpecialValuesOK

--
Biff
Microsoft Excel MVP


"Doebaby" wrote in message
...
Hi,

I am trying to create (what I thought was a small project) a Christmas
Grab
Bag, sort of speak. A person would type in his/her name and then the
computer
would randomly pick out one name of the people in the grab bag. I am
trying
to use vlookup but I don't know how to have the computer only pick the
name
once, with out using his/her own name. Does anyone have any ideas????
Below
is an example of what I am trying to do.

Joe
Mary
Bob
Jane
Enter your name: Joe
You Have: Bob

Is this way beyond something for excel??? It's way beyond me. I thought
it
would work but I can't seem to find any functions to make this turn
out.

Can someone please help?????













  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 863
Default Would I use "Lookup" to pick names for a Christmas grab bag

If you have 10 people then only 5 of them get to enter their name.

Don't understand...

I didn't see the beginning of this this thread, and I'm not sure what the
"grab bag" is supposed to do, but if it is, e.g. buying a gift for the person
whose name you draw, A can buy a gift for B, and B can buy a gift for K. And A
could receive a give from E. It wouldn't have to be B buying a gift for A,
would it?


On Fri, 2 Nov 2007 17:26:54 -0400, "T. Valko" wrote:

Can it be done this way?????


Probably, but it'll be more complicated than what I suggested already. And,
doing it that way it's not truly random. So, now you have to have some

process to
see who gets to enter their name! <g

Let me see what I can come up with.

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 863
Default Would I use "Lookup" to pick names for a Christmas grab bag

On Fri, 2 Nov 2007 17:26:54 -0400, "T. Valko" wrote:

Probably, but it'll be more complicated than what I suggested already. And,
doing it that way it's not truly random. If you have 10 people then only 5
of them get to enter their name. So, now you have to have some process to
see who gets to enter their name! <g


Couldn't you generate the list once, as you originally described, pairing each
person with a randomly chosen member of the group, convert the results to a
fixed list, then when the person types their name in, it looks that name up in
column A and returns the name from column B?
  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Would I use "Lookup" to pick names for a Christmas grab bag

Hi Myrna,

Yes, I could us the orginal formula given. It does work fine but then I
would be the one knowing all who match's to who, even my own name. I didn't
realize how complicated it would be. In the end, if I don't receive anymore
ideas. I will have to do something and will probably use the orginal. I
still have some time and T.Valko expressed he might try to find something
that may work. So until then, I will wait and see. Thank you for responding.

"Myrna Larson" wrote:

On Fri, 2 Nov 2007 17:26:54 -0400, "T. Valko" wrote:

Probably, but it'll be more complicated than what I suggested already. And,
doing it that way it's not truly random. If you have 10 people then only 5
of them get to enter their name. So, now you have to have some process to
see who gets to enter their name! <g


Couldn't you generate the list once, as you originally described, pairing each
person with a randomly chosen member of the group, convert the results to a
fixed list, then when the person types their name in, it looks that name up in
column A and returns the name from column B?

  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Would I use "Lookup" to pick names for a Christmas grab bag

Yeah, you could do that but then the results would already be predetermined.
I came up with something that's totally random but it's kind of complicated
for an average user. It uses an event macro and circular references. I'll
post it Sunday night when I get a chance. It's going to take a lot of
explanation!

--
Biff
Microsoft Excel MVP


"Myrna Larson" wrote in message
...
On Fri, 2 Nov 2007 17:26:54 -0400, "T. Valko"
wrote:

Probably, but it'll be more complicated than what I suggested already.
And,
doing it that way it's not truly random. If you have 10 people then only 5
of them get to enter their name. So, now you have to have some process to
see who gets to enter their name! <g


Couldn't you generate the list once, as you originally described, pairing
each
person with a randomly chosen member of the group, convert the results to
a
fixed list, then when the person types their name in, it looks that name
up in
column A and returns the name from column B?



  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Would I use "Lookup" to pick names for a Christmas grab bag

Ok, this is much more complicated than my other suggestion but it does
exactly what you want. I'll include a link to a sample file so that after
you read the setup you can see how it works before you attempt to recreate
it.

This method uses an event macro and circular reference formulas. You'll have
to enable macros for it to work and set iteration.

Do this first:

Goto the menu ToolsOptionsCalculation tab
Select Iteration
Set maximum iterations to 1
OK out

A2:A11 = list of nmes
F2:F11 = same list of names

Set conditional formatting to highlight the names that are used:

Select the range A2:A11
Goto the menu FormatConditional Formatting
Formula Is: =COUNTIF($C$2:$C$11,A2)
Click the Format button
Select the Patterns tab
Select a fill color of your choice
OK out

Select the range F2:F11
Goto the menu FormatConditional Formatting
Formula Is: =COUNTIF(D$2:D$11,F2)
Click the Format button
Select the Patterns tab
Select a fill color of your choice
OK out

To eliminate potential problems if someone types in their name and makes a
spelling error I used a drop down list so they can simply select their name
from the list. We need a special formula to generate the names that will
populate the list. I put this list off screen in an out of sight location.
So, enter this array formula** in O2 and copy down to O11:

=INDEX(A$2:A$11,SMALL(IF(ISNA(MATCH(A$2:A$11,C$2:C $11,0)),ROW(A$2:A$11)-MIN(ROW(A$2:A$11))+1),ROWS($1:1)))

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER)

Now, setup the drop down list:

Select the range C2:C11
Goto the menu DataValidation
Allow: List
Source: =OFFSET(O$2,,,SUM(--ISTEXT(O$2:O$11)))
OK out

Enter this array formula** in cell D2 and copy down to D11:

=IF(C2="","",INDEX(A$2:A$11,MATCH(MAX(IF(A$2:A$11< C2,N$2:N$11)),N$2:N$11,0)))

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER)

Enter this formula in cell N2 and copy down to N11:

=IF(COUNTIF(D$2:D$11,A2),"",RAND())

Now, install the event macro:

Select the sheet tab and right click
Select View Code
Paste the code below into the window that opens:

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Me.Range("C2:C11")) Is Nothing Then Exit Sub
On Error GoTo enditall
Application.EnableEvents = False
If Target.Value < "" Then
With Target.Offset(0, 1)
.Value = .Value
End With
End If
enditall:
Application.EnableEvents = True
End Sub

What this code does is when a selection is made from the drop down list in
C2:C11 it converts the formula in the corresponding cell in D2:D11 to a
constant. This keeps the names from changing because we're using volatile
RAND() functions. The only drawback to this is that once you've gone through
the entire list all the formulas are gone. If you want to do this again then
you'd have to clear the data from C2:D11 and re-enter the formulas in
D2:D11.

This code is set to the range C2:D11. If you want to use a different range
then you'd have to change this line to reflect your actual range.

If Intersect(Target, Me.Range("C2:C11")) Is Nothing Then Exit Sub

Now you can exit the VBA editor and return back to Excel. Click the top "X"
to close the window.

OK, now you're ready to try it out. Select cell C2 and select a name.
Everytime you select a cell and select a name that name is removed from the
drop down list so that by the time you select the last cell there is only
one name available to select.

I put an "extra" copy of the formula for column D in cell P2. Remember some
of these formulas are array formulas**.

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER)

Here's the link to the sample file:

Grab Bag.xls 24 kb

http://cjoint.com/?letiWtlj4S

This seems way too complicated for the "simple" task at hand, but there you
go!


--
Biff
Microsoft Excel MVP


"Doebaby" wrote in message
...
Hi Myrna,

Yes, I could us the orginal formula given. It does work fine but then I
would be the one knowing all who match's to who, even my own name. I
didn't
realize how complicated it would be. In the end, if I don't receive
anymore
ideas. I will have to do something and will probably use the orginal. I
still have some time and T.Valko expressed he might try to find something
that may work. So until then, I will wait and see. Thank you for
responding.

"Myrna Larson" wrote:

On Fri, 2 Nov 2007 17:26:54 -0400, "T. Valko"
wrote:

Probably, but it'll be more complicated than what I suggested already.
And,
doing it that way it's not truly random. If you have 10 people then only
5
of them get to enter their name. So, now you have to have some process
to
see who gets to enter their name! <g


Couldn't you generate the list once, as you originally described, pairing
each
person with a randomly chosen member of the group, convert the results to
a
fixed list, then when the person types their name in, it looks that name
up in
column A and returns the name from column B?





  #11   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Would I use "Lookup" to pick names for a Christmas grab bag

This is great!!!!! I have sampled it and it works like a gem. Thank you so
much for your time and effort. I really do appreciate everything you did. :)

"T. Valko" wrote:

Ok, this is much more complicated than my other suggestion but it does
exactly what you want. I'll include a link to a sample file so that after
you read the setup you can see how it works before you attempt to recreate
it.

This method uses an event macro and circular reference formulas. You'll have
to enable macros for it to work and set iteration.

Do this first:

Goto the menu ToolsOptionsCalculation tab
Select Iteration
Set maximum iterations to 1
OK out

A2:A11 = list of nmes
F2:F11 = same list of names

Set conditional formatting to highlight the names that are used:

Select the range A2:A11
Goto the menu FormatConditional Formatting
Formula Is: =COUNTIF($C$2:$C$11,A2)
Click the Format button
Select the Patterns tab
Select a fill color of your choice
OK out

Select the range F2:F11
Goto the menu FormatConditional Formatting
Formula Is: =COUNTIF(D$2:D$11,F2)
Click the Format button
Select the Patterns tab
Select a fill color of your choice
OK out

To eliminate potential problems if someone types in their name and makes a
spelling error I used a drop down list so they can simply select their name
from the list. We need a special formula to generate the names that will
populate the list. I put this list off screen in an out of sight location.
So, enter this array formula** in O2 and copy down to O11:

=INDEX(A$2:A$11,SMALL(IF(ISNA(MATCH(A$2:A$11,C$2:C $11,0)),ROW(A$2:A$11)-MIN(ROW(A$2:A$11))+1),ROWS($1:1)))

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER)

Now, setup the drop down list:

Select the range C2:C11
Goto the menu DataValidation
Allow: List
Source: =OFFSET(O$2,,,SUM(--ISTEXT(O$2:O$11)))
OK out

Enter this array formula** in cell D2 and copy down to D11:

=IF(C2="","",INDEX(A$2:A$11,MATCH(MAX(IF(A$2:A$11< C2,N$2:N$11)),N$2:N$11,0)))

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER)

Enter this formula in cell N2 and copy down to N11:

=IF(COUNTIF(D$2:D$11,A2),"",RAND())

Now, install the event macro:

Select the sheet tab and right click
Select View Code
Paste the code below into the window that opens:

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Me.Range("C2:C11")) Is Nothing Then Exit Sub
On Error GoTo enditall
Application.EnableEvents = False
If Target.Value < "" Then
With Target.Offset(0, 1)
.Value = .Value
End With
End If
enditall:
Application.EnableEvents = True
End Sub

What this code does is when a selection is made from the drop down list in
C2:C11 it converts the formula in the corresponding cell in D2:D11 to a
constant. This keeps the names from changing because we're using volatile
RAND() functions. The only drawback to this is that once you've gone through
the entire list all the formulas are gone. If you want to do this again then
you'd have to clear the data from C2:D11 and re-enter the formulas in
D2:D11.

This code is set to the range C2:D11. If you want to use a different range
then you'd have to change this line to reflect your actual range.

If Intersect(Target, Me.Range("C2:C11")) Is Nothing Then Exit Sub

Now you can exit the VBA editor and return back to Excel. Click the top "X"
to close the window.

OK, now you're ready to try it out. Select cell C2 and select a name.
Everytime you select a cell and select a name that name is removed from the
drop down list so that by the time you select the last cell there is only
one name available to select.

I put an "extra" copy of the formula for column D in cell P2. Remember some
of these formulas are array formulas**.

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER)

Here's the link to the sample file:

Grab Bag.xls 24 kb

http://cjoint.com/?letiWtlj4S

This seems way too complicated for the "simple" task at hand, but there you
go!


--
Biff
Microsoft Excel MVP


"Doebaby" wrote in message
...
Hi Myrna,

Yes, I could us the orginal formula given. It does work fine but then I
would be the one knowing all who match's to who, even my own name. I
didn't
realize how complicated it would be. In the end, if I don't receive
anymore
ideas. I will have to do something and will probably use the orginal. I
still have some time and T.Valko expressed he might try to find something
that may work. So until then, I will wait and see. Thank you for
responding.

"Myrna Larson" wrote:

On Fri, 2 Nov 2007 17:26:54 -0400, "T. Valko"
wrote:

Probably, but it'll be more complicated than what I suggested already.
And,
doing it that way it's not truly random. If you have 10 people then only
5
of them get to enter their name. So, now you have to have some process
to
see who gets to enter their name! <g

Couldn't you generate the list once, as you originally described, pairing
each
person with a randomly chosen member of the group, convert the results to
a
fixed list, then when the person types their name in, it looks that name
up in
column A and returns the name from column B?




  #12   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Would I use "Lookup" to pick names for a Christmas grab bag

You're welcome. Thanks for the feedback!

--
Biff
Microsoft Excel MVP


"Doebaby" wrote in message
...
This is great!!!!! I have sampled it and it works like a gem. Thank you so
much for your time and effort. I really do appreciate everything you did.
:)

"T. Valko" wrote:

Ok, this is much more complicated than my other suggestion but it does
exactly what you want. I'll include a link to a sample file so that after
you read the setup you can see how it works before you attempt to
recreate
it.

This method uses an event macro and circular reference formulas. You'll
have
to enable macros for it to work and set iteration.

Do this first:

Goto the menu ToolsOptionsCalculation tab
Select Iteration
Set maximum iterations to 1
OK out

A2:A11 = list of nmes
F2:F11 = same list of names

Set conditional formatting to highlight the names that are used:

Select the range A2:A11
Goto the menu FormatConditional Formatting
Formula Is: =COUNTIF($C$2:$C$11,A2)
Click the Format button
Select the Patterns tab
Select a fill color of your choice
OK out

Select the range F2:F11
Goto the menu FormatConditional Formatting
Formula Is: =COUNTIF(D$2:D$11,F2)
Click the Format button
Select the Patterns tab
Select a fill color of your choice
OK out

To eliminate potential problems if someone types in their name and makes
a
spelling error I used a drop down list so they can simply select their
name
from the list. We need a special formula to generate the names that will
populate the list. I put this list off screen in an out of sight
location.
So, enter this array formula** in O2 and copy down to O11:

=INDEX(A$2:A$11,SMALL(IF(ISNA(MATCH(A$2:A$11,C$2:C $11,0)),ROW(A$2:A$11)-MIN(ROW(A$2:A$11))+1),ROWS($1:1)))

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER)

Now, setup the drop down list:

Select the range C2:C11
Goto the menu DataValidation
Allow: List
Source: =OFFSET(O$2,,,SUM(--ISTEXT(O$2:O$11)))
OK out

Enter this array formula** in cell D2 and copy down to D11:

=IF(C2="","",INDEX(A$2:A$11,MATCH(MAX(IF(A$2:A$11< C2,N$2:N$11)),N$2:N$11,0)))

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER)

Enter this formula in cell N2 and copy down to N11:

=IF(COUNTIF(D$2:D$11,A2),"",RAND())

Now, install the event macro:

Select the sheet tab and right click
Select View Code
Paste the code below into the window that opens:

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Me.Range("C2:C11")) Is Nothing Then Exit Sub
On Error GoTo enditall
Application.EnableEvents = False
If Target.Value < "" Then
With Target.Offset(0, 1)
.Value = .Value
End With
End If
enditall:
Application.EnableEvents = True
End Sub

What this code does is when a selection is made from the drop down list
in
C2:C11 it converts the formula in the corresponding cell in D2:D11 to a
constant. This keeps the names from changing because we're using volatile
RAND() functions. The only drawback to this is that once you've gone
through
the entire list all the formulas are gone. If you want to do this again
then
you'd have to clear the data from C2:D11 and re-enter the formulas in
D2:D11.

This code is set to the range C2:D11. If you want to use a different
range
then you'd have to change this line to reflect your actual range.

If Intersect(Target, Me.Range("C2:C11")) Is Nothing Then Exit Sub

Now you can exit the VBA editor and return back to Excel. Click the top
"X"
to close the window.

OK, now you're ready to try it out. Select cell C2 and select a name.
Everytime you select a cell and select a name that name is removed from
the
drop down list so that by the time you select the last cell there is only
one name available to select.

I put an "extra" copy of the formula for column D in cell P2. Remember
some
of these formulas are array formulas**.

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER)

Here's the link to the sample file:

Grab Bag.xls 24 kb

http://cjoint.com/?letiWtlj4S

This seems way too complicated for the "simple" task at hand, but there
you
go!


--
Biff
Microsoft Excel MVP


"Doebaby" wrote in message
...
Hi Myrna,

Yes, I could us the orginal formula given. It does work fine but then I
would be the one knowing all who match's to who, even my own name. I
didn't
realize how complicated it would be. In the end, if I don't receive
anymore
ideas. I will have to do something and will probably use the orginal.
I
still have some time and T.Valko expressed he might try to find
something
that may work. So until then, I will wait and see. Thank you for
responding.

"Myrna Larson" wrote:

On Fri, 2 Nov 2007 17:26:54 -0400, "T. Valko"
wrote:

Probably, but it'll be more complicated than what I suggested
already.
And,
doing it that way it's not truly random. If you have 10 people then
only
5
of them get to enter their name. So, now you have to have some
process
to
see who gets to enter their name! <g

Couldn't you generate the list once, as you originally described,
pairing
each
person with a randomly chosen member of the group, convert the results
to
a
fixed list, then when the person types their name in, it looks that
name
up in
column A and returns the name from column B?






  #13   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Would I use "Lookup" to pick names for a Christmas grab bag

Is there any way to modify this so certain combinations cannot occur?

For example, we don't want Name1 to get Name2 (or vice versa).

  #14   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 863
Default Would I use "Lookup" to pick names for a Christmas grab bag

What you are saying now it that it ISN'T a random pairing.

I think your life will be much easier if you generate the list once, as originally
suggested, "freeze" the values, and make any additional modifications needed. So what if
YOU know who is paired with whom?


On Wed, 07 Nov 2007 06:36:08 -0800, wrote:

Is there any way to modify this so certain combinations cannot occur?

For example, we don't want Name1 to get Name2 (or vice versa).

Reply
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
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM
"Pick From List . . . " JP Excel Discussion (Misc queries) 5 February 8th 07 08:55 PM
Lookup using 2 cells as the "X" and "Y" coordinates.... kcsims Excel Worksheet Functions 1 December 15th 06 09:06 PM
HELP on "left","right","find","len","substitute" functions serene83 Excel Discussion (Misc queries) 5 June 27th 06 02:23 AM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM


All times are GMT +1. The time now is 04:31 PM.

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

About Us

"It's about Microsoft Excel"