ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Comparing to a range and printing value (https://www.excelbanter.com/excel-discussion-misc-queries/177808-comparing-range-printing-value.html)

Alyssa M

Comparing to a range and printing value
 
Hello,

I have a column of data like this (just a sample):
16.81
17.25
16.51
17.63
17.07

Then, at a different area in the same worksheet I have three other columns
like this (again, just a sample):
16.5 16.74 3.1
16.75 16.99 3.07
17 17.24 3.07
17.25 17.49 3.07
17.5 17.74 3.04

What I want to do is take the number from the first set (i.e. 16.81), figure
out which range it corresponds to in the second data set (16.75 - 17) and
then print the 3rd number in the second set (3.07) in the cell next to the
number in the first set. So, I'd get:

16.81 3.07
17.25 3.07
16.51 3.1
17.63 3.04
17.07 3.07

Any suggestions would be much appreciated!


T. Valko

Comparing to a range and printing value
 
Try this:

With this table in the range G1:I5 -

16.5 16.74 3.1
16.75 16.99 3.07
17 17.24 3.07
17.25 17.49 3.07
17.5 17.74 3.04


A1 = 16.81

=VLOOKUP(A1,G$1:I$5,3)


--
Biff
Microsoft Excel MVP


"Alyssa M" <Alyssa wrote in message
...
Hello,

I have a column of data like this (just a sample):
16.81
17.25
16.51
17.63
17.07

Then, at a different area in the same worksheet I have three other columns
like this (again, just a sample):
16.5 16.74 3.1
16.75 16.99 3.07
17 17.24 3.07
17.25 17.49 3.07
17.5 17.74 3.04

What I want to do is take the number from the first set (i.e. 16.81),
figure
out which range it corresponds to in the second data set (16.75 - 17) and
then print the 3rd number in the second set (3.07) in the cell next to the
number in the first set. So, I'd get:

16.81 3.07
17.25 3.07
16.51 3.1
17.63 3.04
17.07 3.07

Any suggestions would be much appreciated!




Alyssa M[_2_]

Comparing to a range and printing value
 
Hi again

Thanks for that! It works for the first part, but what I actually have is 5
rows in the second table:

16.5 16.74 3.1 4.2 4.5
16.75 16.99 3.07 4.1 4.4
17 17.24 3.07 4.2 4.6
17.25 17.49 3.07 4.3 4.4
17.5 17.74 3.04 4.1 4.3


Sometimes I need to print the 3rd number, other times I'd need the 4th or
5th. How can I do this? I have tried:

=VLOOKUP(A1,(G$1:H$5,K$1:K$5),3)

and

=VLOOKUP(A1,AND(G$1:H$5,K$1:K$5),3)

and other variations, but nothing seems to work. Is there any way to do this?

Thanks again!!


"T. Valko" wrote:

Try this:

With this table in the range G1:I5 -

16.5 16.74 3.1
16.75 16.99 3.07
17 17.24 3.07
17.25 17.49 3.07
17.5 17.74 3.04


A1 = 16.81

=VLOOKUP(A1,G$1:I$5,3)


--
Biff
Microsoft Excel MVP


"Alyssa M" <Alyssa wrote in message
...
Hello,

I have a column of data like this (just a sample):
16.81
17.25
16.51
17.63
17.07

Then, at a different area in the same worksheet I have three other columns
like this (again, just a sample):
16.5 16.74 3.1
16.75 16.99 3.07
17 17.24 3.07
17.25 17.49 3.07
17.5 17.74 3.04

What I want to do is take the number from the first set (i.e. 16.81),
figure
out which range it corresponds to in the second data set (16.75 - 17) and
then print the 3rd number in the second set (3.07) in the cell next to the
number in the first set. So, I'd get:

16.81 3.07
17.25 3.07
16.51 3.1
17.63 3.04
17.07 3.07

Any suggestions would be much appreciated!





Alyssa M[_2_]

Comparing to a range and printing value
 
Ooops! Never mind! I didn't realize that the last number was the column
number (I thought it was searching for the number closest to 3 for some
reason).

Anyway, thank you so much! You just saved me a ton of time :D

"Alyssa M" wrote:

Hi again

Thanks for that! It works for the first part, but what I actually have is 5
rows in the second table:

16.5 16.74 3.1 4.2 4.5
16.75 16.99 3.07 4.1 4.4
17 17.24 3.07 4.2 4.6
17.25 17.49 3.07 4.3 4.4
17.5 17.74 3.04 4.1 4.3


Sometimes I need to print the 3rd number, other times I'd need the 4th or
5th. How can I do this? I have tried:

=VLOOKUP(A1,(G$1:H$5,K$1:K$5),3)

and

=VLOOKUP(A1,AND(G$1:H$5,K$1:K$5),3)

and other variations, but nothing seems to work. Is there any way to do this?

Thanks again!!


"T. Valko" wrote:

Try this:

With this table in the range G1:I5 -

16.5 16.74 3.1
16.75 16.99 3.07
17 17.24 3.07
17.25 17.49 3.07
17.5 17.74 3.04


A1 = 16.81

=VLOOKUP(A1,G$1:I$5,3)


--
Biff
Microsoft Excel MVP


"Alyssa M" <Alyssa wrote in message
...
Hello,

I have a column of data like this (just a sample):
16.81
17.25
16.51
17.63
17.07

Then, at a different area in the same worksheet I have three other columns
like this (again, just a sample):
16.5 16.74 3.1
16.75 16.99 3.07
17 17.24 3.07
17.25 17.49 3.07
17.5 17.74 3.04

What I want to do is take the number from the first set (i.e. 16.81),
figure
out which range it corresponds to in the second data set (16.75 - 17) and
then print the 3rd number in the second set (3.07) in the cell next to the
number in the first set. So, I'd get:

16.81 3.07
17.25 3.07
16.51 3.1
17.63 3.04
17.07 3.07

Any suggestions would be much appreciated!





T. Valko

Comparing to a range and printing value
 
How do you determine which column number you want? You can probably factor
that into the formula instead of changing the formula all the time.

--
Biff
Microsoft Excel MVP


"Alyssa M" wrote in message
...
Ooops! Never mind! I didn't realize that the last number was the column
number (I thought it was searching for the number closest to 3 for some
reason).

Anyway, thank you so much! You just saved me a ton of time :D

"Alyssa M" wrote:

Hi again

Thanks for that! It works for the first part, but what I actually have is
5
rows in the second table:

16.5 16.74 3.1 4.2 4.5
16.75 16.99 3.07 4.1 4.4
17 17.24 3.07 4.2 4.6
17.25 17.49 3.07 4.3 4.4
17.5 17.74 3.04 4.1 4.3


Sometimes I need to print the 3rd number, other times I'd need the 4th or
5th. How can I do this? I have tried:

=VLOOKUP(A1,(G$1:H$5,K$1:K$5),3)

and

=VLOOKUP(A1,AND(G$1:H$5,K$1:K$5),3)

and other variations, but nothing seems to work. Is there any way to do
this?

Thanks again!!


"T. Valko" wrote:

Try this:

With this table in the range G1:I5 -

16.5 16.74 3.1
16.75 16.99 3.07
17 17.24 3.07
17.25 17.49 3.07
17.5 17.74 3.04

A1 = 16.81

=VLOOKUP(A1,G$1:I$5,3)


--
Biff
Microsoft Excel MVP


"Alyssa M" <Alyssa wrote in message
...
Hello,

I have a column of data like this (just a sample):
16.81
17.25
16.51
17.63
17.07

Then, at a different area in the same worksheet I have three other
columns
like this (again, just a sample):
16.5 16.74 3.1
16.75 16.99 3.07
17 17.24 3.07
17.25 17.49 3.07
17.5 17.74 3.04

What I want to do is take the number from the first set (i.e. 16.81),
figure
out which range it corresponds to in the second data set (16.75 - 17)
and
then print the 3rd number in the second set (3.07) in the cell next
to the
number in the first set. So, I'd get:

16.81 3.07
17.25 3.07
16.51 3.1
17.63 3.04
17.07 3.07

Any suggestions would be much appreciated!








All times are GMT +1. The time now is 06:03 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com