Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
cambridge
 
Posts: n/a
Default vlookup and IF function

I am trying to use vlookup and nested IF functions, but cannot get it to
work-maybe I am not using the right funtions. I have a number that I want to
look up and if it is not found, I want to add 1 to it and look that up. I
only need to do it about 5 times so I thought if I used vlookup & nested IF's
I could get it. Here is example:

A
1 2
2 5
3 6
4 7
I want to start with looking up 3 and if it is there, return 3 but if it
isn't, add 1 to the 3 and look it up and return it, and if it isn't add 2 to
the 3, look it up and return it and if it isn't, return 0.

Any ideas?
  #2   Report Post  
Frank Kabel
 
Posts: n/a
Default

Hi
if your data is sorted ascending try:
=VLOOKUP(3,A1:A20,1,TRUE)

--
Regards
Frank Kabel
Frankfurt, Germany

"cambridge" schrieb im
Newsbeitrag ...
I am trying to use vlookup and nested IF functions, but cannot get it

to
work-maybe I am not using the right funtions. I have a number that I

want to
look up and if it is not found, I want to add 1 to it and look that

up. I
only need to do it about 5 times so I thought if I used vlookup &

nested IF's
I could get it. Here is example:

A
1 2
2 5
3 6
4 7
I want to start with looking up 3 and if it is there, return 3 but if

it
isn't, add 1 to the 3 and look it up and return it, and if it isn't

add 2 to
the 3, look it up and return it and if it isn't, return 0.

Any ideas?


  #3   Report Post  
cambridge
 
Posts: n/a
Default

That is the basic formula for vlookup, but if it doesn't find 3 in the data,
I want to add 1 to the 3 and have it look for 4. This is what I have tried
and it doesn't totally work:
=if(vlookup($d3,a1:a20,1,false)=d3,d3,if(vlookup(( $d3+1),a1:a20,1,false)=(d3+1),(d3+1),0)

This formula actually works but if I want to nest another IF statement for
d3+2, it tells me I have too many arguements. I would like to nest up to 5
times.

"Frank Kabel" wrote:

Hi
if your data is sorted ascending try:
=VLOOKUP(3,A1:A20,1,TRUE)

--
Regards
Frank Kabel
Frankfurt, Germany

"cambridge" schrieb im
Newsbeitrag ...
I am trying to use vlookup and nested IF functions, but cannot get it

to
work-maybe I am not using the right funtions. I have a number that I

want to
look up and if it is not found, I want to add 1 to it and look that

up. I
only need to do it about 5 times so I thought if I used vlookup &

nested IF's
I could get it. Here is example:

A
1 2
2 5
3 6
4 7
I want to start with looking up 3 and if it is there, return 3 but if

it
isn't, add 1 to the 3 and look it up and return it, and if it isn't

add 2 to
the 3, look it up and return it and if it isn't, return 0.

Any ideas?



  #4   Report Post  
Frank Kabel
 
Posts: n/a
Default

Hi
try the formula. It should find the value that is equal or larger than
3 (if your data is sorted ascending)

--
Regards
Frank Kabel
Frankfurt, Germany

"cambridge" schrieb im
Newsbeitrag ...
That is the basic formula for vlookup, but if it doesn't find 3 in

the data,
I want to add 1 to the 3 and have it look for 4. This is what I have

tried
and it doesn't totally work:

=if(vlookup($d3,a1:a20,1,false)=d3,d3,if(vlookup(( $d3+1),a1:a20,1,false
)=(d3+1),(d3+1),0)

This formula actually works but if I want to nest another IF

statement for
d3+2, it tells me I have too many arguements. I would like to nest

up to 5
times.

"Frank Kabel" wrote:

Hi
if your data is sorted ascending try:
=VLOOKUP(3,A1:A20,1,TRUE)

--
Regards
Frank Kabel
Frankfurt, Germany

"cambridge" schrieb im
Newsbeitrag

...
I am trying to use vlookup and nested IF functions, but cannot

get it
to
work-maybe I am not using the right funtions. I have a number

that I
want to
look up and if it is not found, I want to add 1 to it and look

that
up. I
only need to do it about 5 times so I thought if I used vlookup &

nested IF's
I could get it. Here is example:

A
1 2
2 5
3 6
4 7
I want to start with looking up 3 and if it is there, return 3

but if
it
isn't, add 1 to the 3 and look it up and return it, and if it

isn't
add 2 to
the 3, look it up and return it and if it isn't, return 0.

Any ideas?




  #5   Report Post  
cambridge
 
Posts: n/a
Default

This does not work or I am doing something wrong. Let's start over. This is
what I have:
A
1 3
2 4
3 6
4 7
5 9

In cell C1, I want to look up 1, and if it doesn't find 1, add 1 to the 1
for 2 and lookup 2, if it finds it, return it and if it doesn't find it, add
2 to the 1 and look up 3, if it finds 3, return 3 otherwise add 3 to the 1
and continue this up to 5 times until it does find a number. And then in C2,
I want it to take the value in C1, add 1 to it, look for it and if it doesn't
find it, add 2 to it and look for and continue this on for up to 5 times
until it finds the number. The formula you sent is a basic vlookup that will
not do this unless I am totally missing something here. There are gaps in
the numbers I am looking in and this is why I am doing this and I think this
is why your formula will not work.
"Frank Kabel" wrote:

Hi
try the formula. It should find the value that is equal or larger than
3 (if your data is sorted ascending)

--
Regards
Frank Kabel
Frankfurt, Germany

"cambridge" schrieb im
Newsbeitrag ...
That is the basic formula for vlookup, but if it doesn't find 3 in

the data,
I want to add 1 to the 3 and have it look for 4. This is what I have

tried
and it doesn't totally work:

=if(vlookup($d3,a1:a20,1,false)=d3,d3,if(vlookup(( $d3+1),a1:a20,1,false
)=(d3+1),(d3+1),0)

This formula actually works but if I want to nest another IF

statement for
d3+2, it tells me I have too many arguements. I would like to nest

up to 5
times.

"Frank Kabel" wrote:

Hi
if your data is sorted ascending try:
=VLOOKUP(3,A1:A20,1,TRUE)

--
Regards
Frank Kabel
Frankfurt, Germany

"cambridge" schrieb im
Newsbeitrag

...
I am trying to use vlookup and nested IF functions, but cannot

get it
to
work-maybe I am not using the right funtions. I have a number

that I
want to
look up and if it is not found, I want to add 1 to it and look

that
up. I
only need to do it about 5 times so I thought if I used vlookup &
nested IF's
I could get it. Here is example:

A
1 2
2 5
3 6
4 7
I want to start with looking up 3 and if it is there, return 3

but if
it
isn't, add 1 to the 3 and look it up and return it, and if it

isn't
add 2 to
the 3, look it up and return it and if it isn't, return 0.

Any ideas?






  #6   Report Post  
Frank Kabel
 
Posts: n/a
Default

Hi
now I see :-)
in C1 try the following array formula (entered with CTRL+SHIFT+ENTER):
=INDEX(A1:A100,MATCH(1,(A1:A100=1)*(A1:A100<=6),0 ))

in C2 enter:
=INDEX(A1:A100,MATCH(1,(A1:A100=C1+1)*(A1:A100<=C 1+5),0))

Still requires the data to be sorted ascending

--
Regards
Frank Kabel
Frankfurt, Germany

"cambridge" schrieb im
Newsbeitrag ...
This does not work or I am doing something wrong. Let's start over.

This is
what I have:
A
1 3
2 4
3 6
4 7
5 9

In cell C1, I want to look up 1, and if it doesn't find 1, add 1 to

the 1
for 2 and lookup 2, if it finds it, return it and if it doesn't find

it, add
2 to the 1 and look up 3, if it finds 3, return 3 otherwise add 3 to

the 1
and continue this up to 5 times until it does find a number. And then

in C2,
I want it to take the value in C1, add 1 to it, look for it and if it

doesn't
find it, add 2 to it and look for and continue this on for up to 5

times
until it finds the number. The formula you sent is a basic vlookup

that will
not do this unless I am totally missing something here. There are

gaps in
the numbers I am looking in and this is why I am doing this and I

think this
is why your formula will not work.
"Frank Kabel" wrote:

Hi
try the formula. It should find the value that is equal or larger

than
3 (if your data is sorted ascending)

--
Regards
Frank Kabel
Frankfurt, Germany

"cambridge" schrieb im
Newsbeitrag

...
That is the basic formula for vlookup, but if it doesn't find 3

in
the data,
I want to add 1 to the 3 and have it look for 4. This is what I

have
tried
and it doesn't totally work:


=if(vlookup($d3,a1:a20,1,false)=d3,d3,if(vlookup(( $d3+1),a1:a20,1,false
)=(d3+1),(d3+1),0)

This formula actually works but if I want to nest another IF

statement for
d3+2, it tells me I have too many arguements. I would like to

nest
up to 5
times.

"Frank Kabel" wrote:

Hi
if your data is sorted ascending try:
=VLOOKUP(3,A1:A20,1,TRUE)

--
Regards
Frank Kabel
Frankfurt, Germany

"cambridge" schrieb im
Newsbeitrag

...
I am trying to use vlookup and nested IF functions, but

cannot
get it
to
work-maybe I am not using the right funtions. I have a

number
that I
want to
look up and if it is not found, I want to add 1 to it and

look
that
up. I
only need to do it about 5 times so I thought if I used

vlookup &
nested IF's
I could get it. Here is example:

A
1 2
2 5
3 6
4 7
I want to start with looking up 3 and if it is there, return

3
but if
it
isn't, add 1 to the 3 and look it up and return it, and if it

isn't
add 2 to
the 3, look it up and return it and if it isn't, return 0.

Any ideas?





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
Vlookup finds a blank, but returns a zero - HELP! flummoxed Excel Discussion (Misc queries) 6 January 18th 05 04:15 PM
Vlookup Syntax Error YV New Users to Excel 9 December 23rd 04 06:28 PM
Excel crashing when typing VLOOKUP Nick Excel Discussion (Misc queries) 2 December 2nd 04 03:27 PM
Need help with modifying VLookUp Tom Excel Discussion (Misc queries) 4 December 2nd 04 01:44 AM
Vlookup with VBA Jeff Excel Discussion (Misc queries) 8 December 1st 04 03:41 PM


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

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"