Run out of nested Ifs

C

Clive Williamson

Please can someone advise about the following problem.

I have a spreadsheet with 2 columns each with parallel data to which other
cells need to refer eg

1 1.5
2 2.7
3 2.9
4 3.1
5 3.5
6 3.8
7 4.1
8 5.2
9 6.3
10 7.3

I also have a data entry cell where I can enter numbers from 1 to 10, and a
result cell which needs a formula which automatically returns the data from
column on the right to match that on the left. To put it simply, if I enter
a 2 into the data cell I want to see 2.7 in the result cell; if I enter 7, I
want to see a result of 4.1

I've managed to do this with a complicated set of nested IF calculations,
but these run out at 7 nests, so I can't do this for all 10 sets of data.

Is there a way of doing this?

Thanks

Clive
 
B

Bob Phillips

=VLOOKUP(A1,{1,1.5;2,2.7;3,2.9;4,3.1;5,3.5;6,3.8;7,4.1;8,5.2;9,6.3;10,7.3},2
,FALSE)

or put the values in a table and refer to that.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
C

Clive Williamson

Thanks. That really seems to work fine. One refinement though: is it
possible to use cell references instead of the 1.5, 2.7 series of numbers? I
can't seem to get that working, and it would solve all of my problems at
once!

Thanks again

Clive
 
C

Clive Williamson

Thanks Bob. This really works well. As a refinement, is it possible to use
cell references within the formula instead of the 1.5, 2.7 series of
numbers? That would really sort things out for me!

Clive
 
B

Bob Phillips

Yes, create a table very simple to the example you posted in say M1:N20 and
use

=VLOOKUP(1,$M$1:$N$20,2,False)

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
C

Clive Williamson

Yes, create a table very simple to the example you posted in say M1:N20 and
use

=VLOOKUP(1,$M$1:$N$20,2,False)



BINGO! Many thanks Bob, you've saved me a lot of aggravation!

Clive
 
A

Arvi Laanemets

Hi


=CHOOSE(YourNumber,$B:$B)
, where YourNumber is a number or cell reference to one. This formula
assumes, that there is no header row in lookup table. When the 1st row
contains headers, the formula will be
=CHOOSE(YourNumber+1,$B:$B)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top