HELP!! Using Vlookup

chrisaustralia

New Member
Joined
Oct 3, 2006
Messages
38
Hi All. Ok, this is kinda complex, well it is in my eyes anyway.

I have an excel spreadsheet with 2 tabs. What i need 2 do in one tab there is all this raw data. And it goes horizontally. In column J, there is a job number, and this usually goes down 5 rows. In column 0, there are different fields being, typesetting and formatting, revisions, account service, PDFs, Colour Print.
In the other tab, I am trying to put these fields vertical. What I am needing is that when the job number is looked up, it will also reference column 0 and put that figure in. The total figure is in column S in the second Tab. And the figure has to go in column N in the first tab.

Bear in mind that the First row on both tabs is a heading row.

Hope someone can help. Let me know if you require more information.
 
With the above screen shots, it seems (if I'm understanding correctly) that if you deleted
or edited the first instance of 'ZU08000' (the one in J2 , Tab 2) your vlookup formula
would return what you're looking for. - or do I misunderstand?
 
Upvote 0

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Hi, as once the first formaula is set up, then I will copy that for the next column along to pick up the revision costs..
Hi Chris,
I'm afraid I don't quite understand what you're saying here.
Are you copying the formula along the columns (to the right) in Tab1 to pickup the value in Tab 2 just below the value for 'typesetting and formatting' then? So on Tab1 you'll have 'ZU08000' in C2 and again in D2, ending up with a horizontal list in tab1 that is looking up values from a verticle list in tab2?
 
Upvote 0
Hi Halface,

The diagram you had was correct. Once the formula is set up like that were its picks up the typesetting and formatting, then I will amend it so that in tab 1 on the next column it will pick up the Revisions cost. But don't worry about that too much. Once the formula is set up for Typsetting and Formatting, then I will be able to make changes to it and use that formaula to pick up the revisions ocst.
 
Upvote 0
OK, now if I understand this completely, give this a try.
(And this example is directly dependant on everything being in the same locations as in the screen shots I posted earlier.)

Go to Tab 2, highlight the entire range you'll want to refer to in the lookup formulas and give it a defined range name. (Name it LookupTable)

Next, paste this function into a standard module:
Code:
Function VLOOKUPNTH(lookup_value, table_array As Range, _
         col_index_num As Integer, nth_value)
Dim nRow As Long
Dim nVal As Integer
Dim bFound As Boolean
  VLOOKUPNTH = "Not Found"
  With table_array
    For nRow = 1 To .Rows.Count
      If .Cells(nRow, 1).Value = lookup_value Then
        nVal = nVal + 1
      End If
      If nVal = nth_value Then
        VLOOKUPNTH = .Cells(nRow, col_index_num).Text
        Exit Function
      End If
    Next nRow
  End With
End Function

Next, in Tab 1, cell N2, enter this formula:
=VLOOKUPNTH($C$2,LookupTable,10,2)
-(returns the value from the 10th column in the lookup table found on the 2nd instance of
the lookup value)

In O2 enter this:
=VLOOKUPNTH($C$2,LookupTable,10,3)
-(returns the value from the 10th column in the lookup table found on the 3rd instance of
the lookup value)

In P2. . .
=VLOOKUPNTH($C$2,LookupTable,10,4)
and so on.

The construction of the formula is:
VLOOKUPNTH(LookupValue, LookupRange, Col_index_num, nth_value)
with the 'nth value' being which instance of the duplicate lookup value you want the formula to return.

Does this help?
 
Upvote 0

Forum statistics

Threads
1,216,218
Messages
6,129,571
Members
449,518
Latest member
srooney

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top