PC Review


Reply
Thread Tools Rate Thread

Comparing cell contents, know cell address

 
 
molsansk
Guest
Posts: n/a
 
      10th Dec 2007
Here is my situation:

-A user enters one of any number in an input cell. Say for example he
enters 10.
-I need to look at cell B12 in this case (actually will always be "B" &
input_number +2, so if they enter 5, I need to look at B7).
-Now I need to look at the contents of this cell B12, which contains the
word "Jim" for example. I then need to compare cell B12 (or whatever cell,
as this will vary), to the next cell down, B13, see if B12=B13.

There may be an easy way to do this, but I can't get it to work. I tried
creating a variable, that took input_number and converted it to "B" & input
number +2. So now I have a varaible that = B12 (will vary based on their
input number). Then tried do =CELL("contents", variable) to pull out the
value of "Jim". Didn't work. I can't enter in B12 here, because that will
vary. Thought the dynamic variable would accomplish that, but doesn't seem
to work.

Any help appreciated. Thanks
 
Reply With Quote
 
 
 
 
John Bundy
Guest
Posts: n/a
 
      10th Dec 2007
Not sure what code you already have but this should show you enough to
understand:
myinput = InputBox("Pick A Number")
MsgBox Sheets(1).Range("B" & myinput + 2) = Sheets(1).Range("B" & myinput + 3)

i set myInput to the number they type in the input box, then i check to see
if on sheet 1 range (cell) B, the input number +2 = range B, and the input
number +3. In your example if they type 10 in the input box this will check
to see if B12=B13.
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"molsansk" wrote:

> Here is my situation:
>
> -A user enters one of any number in an input cell. Say for example he
> enters 10.
> -I need to look at cell B12 in this case (actually will always be "B" &
> input_number +2, so if they enter 5, I need to look at B7).
> -Now I need to look at the contents of this cell B12, which contains the
> word "Jim" for example. I then need to compare cell B12 (or whatever cell,
> as this will vary), to the next cell down, B13, see if B12=B13.
>
> There may be an easy way to do this, but I can't get it to work. I tried
> creating a variable, that took input_number and converted it to "B" & input
> number +2. So now I have a varaible that = B12 (will vary based on their
> input number). Then tried do =CELL("contents", variable) to pull out the
> value of "Jim". Didn't work. I can't enter in B12 here, because that will
> vary. Thought the dynamic variable would accomplish that, but doesn't seem
> to work.
>
> Any help appreciated. Thanks

 
Reply With Quote
 
molsansk
Guest
Posts: n/a
 
      10th Dec 2007
To clarify here, I am not using code. Just basic excel functions. They
input into a cell in the worksheet, and the variable I mention is just an
excel "name".

"John Bundy" wrote:

> Not sure what code you already have but this should show you enough to
> understand:
> myinput = InputBox("Pick A Number")
> MsgBox Sheets(1).Range("B" & myinput + 2) = Sheets(1).Range("B" & myinput + 3)
>
> i set myInput to the number they type in the input box, then i check to see
> if on sheet 1 range (cell) B, the input number +2 = range B, and the input
> number +3. In your example if they type 10 in the input box this will check
> to see if B12=B13.
> --
> -John
> Please rate when your question is answered to help us and others know what
> is helpful.
>
>
> "molsansk" wrote:
>
> > Here is my situation:
> >
> > -A user enters one of any number in an input cell. Say for example he
> > enters 10.
> > -I need to look at cell B12 in this case (actually will always be "B" &
> > input_number +2, so if they enter 5, I need to look at B7).
> > -Now I need to look at the contents of this cell B12, which contains the
> > word "Jim" for example. I then need to compare cell B12 (or whatever cell,
> > as this will vary), to the next cell down, B13, see if B12=B13.
> >
> > There may be an easy way to do this, but I can't get it to work. I tried
> > creating a variable, that took input_number and converted it to "B" & input
> > number +2. So now I have a varaible that = B12 (will vary based on their
> > input number). Then tried do =CELL("contents", variable) to pull out the
> > value of "Jim". Didn't work. I can't enter in B12 here, because that will
> > vary. Thought the dynamic variable would accomplish that, but doesn't seem
> > to work.
> >
> > Any help appreciated. Thanks

 
Reply With Quote
 
John Bundy
Guest
Posts: n/a
 
      10th Dec 2007
I apologize, i thought i was in the programming, i'll pay more attention
You want the Indirect function, in your case it will look like this, say
they enter 10 into cell A1
=INDIRECT("B" & A1+2)
If you put this in the cell where you want your answer you will get the
value in B12.
Going further,
=IF(INDIRECT("B" & A1+2)=INDIRECT("B" & A1+3),"Match","No Match")
this checks to see if what is in B12=B13, if so it returns "Match", if not,
"No Match".
I hope i have redeemed myself!
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"molsansk" wrote:

> To clarify here, I am not using code. Just basic excel functions. They
> input into a cell in the worksheet, and the variable I mention is just an
> excel "name".
>
> "John Bundy" wrote:
>
> > Not sure what code you already have but this should show you enough to
> > understand:
> > myinput = InputBox("Pick A Number")
> > MsgBox Sheets(1).Range("B" & myinput + 2) = Sheets(1).Range("B" & myinput + 3)
> >
> > i set myInput to the number they type in the input box, then i check to see
> > if on sheet 1 range (cell) B, the input number +2 = range B, and the input
> > number +3. In your example if they type 10 in the input box this will check
> > to see if B12=B13.
> > --
> > -John
> > Please rate when your question is answered to help us and others know what
> > is helpful.
> >
> >
> > "molsansk" wrote:
> >
> > > Here is my situation:
> > >
> > > -A user enters one of any number in an input cell. Say for example he
> > > enters 10.
> > > -I need to look at cell B12 in this case (actually will always be "B" &
> > > input_number +2, so if they enter 5, I need to look at B7).
> > > -Now I need to look at the contents of this cell B12, which contains the
> > > word "Jim" for example. I then need to compare cell B12 (or whatever cell,
> > > as this will vary), to the next cell down, B13, see if B12=B13.
> > >
> > > There may be an easy way to do this, but I can't get it to work. I tried
> > > creating a variable, that took input_number and converted it to "B" & input
> > > number +2. So now I have a varaible that = B12 (will vary based on their
> > > input number). Then tried do =CELL("contents", variable) to pull out the
> > > value of "Jim". Didn't work. I can't enter in B12 here, because that will
> > > vary. Thought the dynamic variable would accomplish that, but doesn't seem
> > > to work.
> > >
> > > Any help appreciated. Thanks

 
Reply With Quote
 
molsansk
Guest
Posts: n/a
 
      10th Dec 2007
No problem. That works. You have definitely redeemed yourself. Thanks for
your help!!!

"John Bundy" wrote:

> I apologize, i thought i was in the programming, i'll pay more attention
> You want the Indirect function, in your case it will look like this, say
> they enter 10 into cell A1
> =INDIRECT("B" & A1+2)
> If you put this in the cell where you want your answer you will get the
> value in B12.
> Going further,
> =IF(INDIRECT("B" & A1+2)=INDIRECT("B" & A1+3),"Match","No Match")
> this checks to see if what is in B12=B13, if so it returns "Match", if not,
> "No Match".
> I hope i have redeemed myself!
> --
> -John
> Please rate when your question is answered to help us and others know what
> is helpful.
>
>
> "molsansk" wrote:
>
> > To clarify here, I am not using code. Just basic excel functions. They
> > input into a cell in the worksheet, and the variable I mention is just an
> > excel "name".
> >
> > "John Bundy" wrote:
> >
> > > Not sure what code you already have but this should show you enough to
> > > understand:
> > > myinput = InputBox("Pick A Number")
> > > MsgBox Sheets(1).Range("B" & myinput + 2) = Sheets(1).Range("B" & myinput + 3)
> > >
> > > i set myInput to the number they type in the input box, then i check to see
> > > if on sheet 1 range (cell) B, the input number +2 = range B, and the input
> > > number +3. In your example if they type 10 in the input box this will check
> > > to see if B12=B13.
> > > --
> > > -John
> > > Please rate when your question is answered to help us and others know what
> > > is helpful.
> > >
> > >
> > > "molsansk" wrote:
> > >
> > > > Here is my situation:
> > > >
> > > > -A user enters one of any number in an input cell. Say for example he
> > > > enters 10.
> > > > -I need to look at cell B12 in this case (actually will always be "B" &
> > > > input_number +2, so if they enter 5, I need to look at B7).
> > > > -Now I need to look at the contents of this cell B12, which contains the
> > > > word "Jim" for example. I then need to compare cell B12 (or whatever cell,
> > > > as this will vary), to the next cell down, B13, see if B12=B13.
> > > >
> > > > There may be an easy way to do this, but I can't get it to work. I tried
> > > > creating a variable, that took input_number and converted it to "B" & input
> > > > number +2. So now I have a varaible that = B12 (will vary based on their
> > > > input number). Then tried do =CELL("contents", variable) to pull out the
> > > > value of "Jim". Didn't work. I can't enter in B12 here, because that will
> > > > vary. Thought the dynamic variable would accomplish that, but doesn't seem
> > > > to work.
> > > >
> > > > Any help appreciated. Thanks

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Return cell address of a cell based on contents of cell. Danny Microsoft Excel Worksheet Functions 4 15th Nov 2008 03:11 AM
Comparing cell contents via VB =?Utf-8?B?UmFqZW5SYWpwdXQx?= Microsoft Excel Misc 5 29th Jun 2007 05:37 PM
Comparing Cell Contents in 2 or More Columns =?Utf-8?B?Q29uZnVzZWROSG91c3Rvbg==?= Microsoft Excel Misc 2 18th Jun 2007 03:08 PM
store cell contents and cell address for comparsion & suming =?Utf-8?B?SmltIFdoZWxjaGVs?= Microsoft Excel Programming 1 24th Nov 2004 04:03 PM
Comparing Cell Contents E. J. Microsoft Excel Worksheet Functions 1 16th Jan 2004 10:02 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:08 AM.