Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default VLOOKUP and formulas help

Hello excel guru's,
I am not sure how to go about this.
I have a sheet with some columns that i need to compare
some values to seee if they are in a lookup in the same
book, then return the id, but i also need a IF statement
to look at column B, to check if it's value is "SUP"

D E F K
2 DEV SVCPK SOME TEXT BLANK
3 SUP 20565 TBAVA BANK BLANK
4 MOD ADBOH SOME TEXT BLANK


Lookup table
A B
1 ADBOH A bank name
2 TBAVA A banks name
etc...

I want to fill in the blanks. I need to check 1st
if the value in column C matches anyvalue in the
lookup list, if it does return the id in the lookup
table to G else enter in "TEST", then i want to
lookup again because if the value in B says
"SUP" then it needs to look up the value from
D, but only the first 5, LEFT(D,5). From there
check against the lookup table again. If it matches
then return the id, else return "TEST".

I have one going already, but it only works with the
lookup for column C, it works, but i don't understand
how to get the IF statement in there, looking for
Column B's value.

Here is the actual code that works, but it doesn't
check for what i need and that is:
If column B.value = "SUP" then
loop through all the rows with SUP value
End if

Becasue i never will know how many rows, how
can i use the For i = 2 To LastRow, to put this in a loop.
Or do i even need to???
thanks for any help, it will be much appreciated.

Keri

code that works so far...
Sub fillBankID()

Dim LastRow As Long
Dim myrange As Range
Dim i As Long

LastRow = Cells(Rows.Count, "A").End(xlUp).Row

Worksheets("Output").Activate
Range("K2:L2").Select
Selection.Clear
Range("K2").Select
Range("K2").Formula = _
"=IF(ISNA(VLOOKUP(E2,CLientList,1,FALSE)),""NAME"" ,
VLOOKUP(E2,ClientList,1,FALSE))"
Range("L2").Select
Range("L2").Formula = "=VLOOKUP(K2,ClientList,2,True)"


With Worksheets("Output")
Range("K2").AutoFill Destination:=.Range("K2:K" & LastRow) _
, Type:=xlFillDefault
.Range("L2").AutoFill Destination:=.Range("L2:L" & LastRow) _
, Type:=xlFillDefault
End With

End Sub

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 Formulas Gayle B Excel Worksheet Functions 5 September 10th 09 07:38 AM
Vlookup with other formulas John Excel Worksheet Functions 1 January 7th 09 12:30 AM
VLOOKUP formulas Donna Excel Worksheet Functions 4 July 9th 06 12:08 AM
VLOOKUP FORMULAS PB Excel Discussion (Misc queries) 1 November 24th 05 10:43 PM
need help with formulas/vlookup Frank Kabel Excel Programming 2 May 27th 04 03:30 PM


All times are GMT +1. The time now is 04:09 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"