Like Vlookup but different...

Tom.Jones

Well-known Member
Joined
Sep 20, 2011
Messages
509
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
  2. Mobile
Howdy

I need a little help.
I receive from an application, an excel file, which has the following structure:
a table (not a real table) with 4 columns and a variable number of rows. Next is an empty column and then another table with 4 columns, and so on. (So far I haven't received more than 21 tables.)
The table header is the same for all tables in the sheet.
Every day we receive this file which does not have a fixed number of tables. Today it can have 9 tables and tomorrow it can have 15, the next day it can have 7 tables.
So in row 1 starting with A1 there are 4 columns with different headers, (but the headers are the same for each table) followed by an empty column and then the next table, and so on.
I would like in another sheet, to be able to write, any item, (or to put a data validation with all the items from the first column of each table) that is in the first column of each table and in the next cell to appear my correspondent from the same row, of the searched item, in column 4 of the table in which the searched item is located.
The data in the first column is unique.
I would like, if it is possible to solve it with formulas, or with VBA code if it is not possible with formulas.
Thanks.
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Hi Tom.Jones
I understand the sheet and the "Tables" I don't inderstand this bit:

"I would like in another sheet, to be able to write, any item, (or to put a data validation with all the items from the first column of each table) that is in the first column of each table and in the next cell to appear my correspondent from the same row, of the searched item, in column 4 of the table in which the searched item is located."

As far as I can understand, you want a new sheet to show all the items from Column A and then beside them show all the cell addresses they show up in the other tables?
 
Upvote 0
As far as I can understand, you want a new sheet to show all the items from Column A and then beside them show all the cell addresses they show up in the other tables?

No.
Let say, in sheet1 cell B2 i will write an item from one of column (first column in one 'table') and in C2 I want to get the words in last column (same row with item I look.
Or create a DV in B2 and in the list of DV to have all items in first column of each 'table'.
Say in B2 sheet1 I choose (or write) Item4 and want in C2 to appear 'af'
If in B2 sheet1 I choose (or write) Item13 and want in C2 to appear 'wrr'

In sheet2 data is like this:
H1H2H3H4H1H2H3H4H1H2H3H4
Item1aassrqrwefItem12XXRRddd afitem17asada
Item2aassmmm ffdaItem13XXRRwrritem18dvthhdh
Item3aasswqqweItem14XXRRwrq ftjhytitem19fgsf
Item4aassafItem15XXRRwqr dheitem20sddgfd dgd
Item5aasshftu jrssyItem16XXRREQWitem21aderwet
Item6aasssrs sgrs ggitem22awds dh th
Item7aassetweitem23rldfsgs
Item8aassdfs dhth
Item9aasserqre gg
Item10aassaafg
Item11aassfewe swt
 
Upvote 0
One option for 365.
Out this formula in (for instance) A2
Excel Formula:
=LET(rng,Sheet2!A2:DA100,r,ROWS(rng),s,SEQUENCE(r*COLUMNS(rng)/5,,0),a,INDEX(rng,MOD(s,r)+1,INT(s/r)*5+{1,4}),FILTER(a,INDEX(a,,1)<>""))
then in your data validation you can use
Excel Formula:
=INDEX(A2#,,1)
You can the use a vlookup to get the relevant value.
 
Upvote 0
Solution
Fluff,

Excellent, excellent job.
I'm curious what a VBA code would look like.
If you have time, I would ask you to write a VBA code.
Anyway, thank you very much.
 
Upvote 0
Glad we could help & thanks for the feedback.
I'll have a look at a macro if I get time.
 
Upvote 0
This code would get you what you want, gust need to call it with a button or a Worksheet Change event
VBA Code:
Sub FindValue()
Sheet1.Range("C2").Value = Sheet2.Cells.Find(what:="item1", lookat:=xlWhole).Offset(0, 3).Value
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,647
Messages
6,126,006
Members
449,280
Latest member
Miahr

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