Solved

Cell reference and find/search formula

Posted on 2011-03-09
7
202 Views
Last Modified: 2012-06-27
Dear Experts, below the question
I would like to establish a user friendly "universal import" sheet as follows:

To sheet one I will import data from Outlook. The data import might differ. Sometimes I might have 5 and sometimes 35 columns. Sometimes the column names e.g. "JG-Owner" or "Asset-Short" will in A1 and let's presume D1, another time they might be in E1 or B1 and also the column names might change, depending from which Outlook database the import will come etc....

On sheet two, three etc. I want to establish ready reports which take data from the "import sheet" and depending on the data copy and pasted to the "import sheet" I will get my ready reports on the other sheets. Ready to be printed or saved....

The reports consist our of different collections of imported fields and to establish them should be as easy as possible.

I like examples more then words and therefore here a made up example:

Sheet1 has the following columns:
A1=Trees, B1=animals, C1=Cars, D1=fruits and E1=Names
I have below the column names each time a different amount of rows with data. I do not know it as long I do not copy and paste. Only after I pasted the data I of course know that there are 50 rows or 1500 rows with data

On Sheet2 I want to establish a report consisting out of:
A1=Names, B1=Cars
Below I want a listing of all rows with respectively Names in A2, A3 etc. and Cars in B2, B3 etc.

My idea:
In A1 I write the column name of my choice, for example "My Colleagues" and in B1 I write "Sport Cars". In A2 and B2 I would write the original column name as from the import. In this case A2 would be Names and B2 would be Cars

The already existing formula I'm now looking for and which must exist already in A3, A4, and B3, B4 etc. must show "nothing" if there is nothing in the import sheet and if the is a value, it must simply show that value.
Moreover the formula should be "able" to "find" the location of the right column on sheet1 based on the original column name stated in A2 and respectively B2 etc.

Based on that formula I could:
1. Change names if needed and have them differ from original names imported
2. I would be more flexible with the data import because I would not need the consistency with the columns in sheet1. It would not make a difference if the car column would be in A1 or Q1 as the formula in sheet2 would find the location of the car column anyway

thank you
Nils
 







 


 

0
Comment
Question by:Petersburg1
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 35092407
Can you throw in a sample sheet which which would

- be closer to what you are looking for
- reduce the work on the part of the expert

Saqib
0
 
LVL 6

Expert Comment

by:Eric Zwiekhorst
ID: 35092421
Dear Petersburg,

This is not to difficult to achieve,

You will have to scan the first row to find wich column  for your example hold "Names"and wich holds"Cars"

So declare variables for this like dim Names() as variant

redim the variants with the length of your data

after you have obtained the correct column number you can read the cells with names(i) = Cells(i,column)
i is the counter from 2 to lastrow...

If you need an example sheet I can provide, just ask..

Kind regrads

eric
0
 
LVL 6

Expert Comment

by:Eric Zwiekhorst
ID: 35092429
ps I am talking about a macro, not a formula...
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 50

Accepted Solution

by:
barry houdini earned 500 total points
ID: 35093772
Hello Nils, If you want to use formulas then one way would be to use this formula in sheet2A3 copied across and down

=INDEX(Sheet1!2:2,MATCH(A$2,Sheet1!$1:$1,0))&""

see attached, try changing A2 to Fruits or another header.....

regards, barry
26876677.xls
0
 

Author Comment

by:Petersburg1
ID: 35095075
Hi Barry,
PERFECT! Thanks a lot. This is what I was looking for.

May I ask you to explain to me the following:

What is the meaning of 2:2 and 3:3 etc. it is the second, third etc. row bu why 2:2?

And what is the meaning/need of &""?

May though and approach was as well INDEX and MATCH but I never ever would have brought this together...
thanks again
0
 

Author Closing Comment

by:Petersburg1
ID: 35095079
Perfect :-)
0
 
LVL 50

Expert Comment

by:barry houdini
ID: 35095185
Yes 1:1 is row 1 and 2:2 is row 2 etc. I used $1:$1 here for row 1 so as the formula is copied down that still refers to row 1 but 2:2 increments each row to 3:3, 4:4 etc. so that the correct data is returned. If you don't need the whole row you can change to a fixed range e.g. $A$1:$Z$1 or similar......

The &"" at the end prevents zero being returned from a blank cell

regards, barry
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Vb.net dynamic formulas in runtime 11 61
Delete texts with font color 16 30
Hard coding time and date into Excel 2 30
InternetExplorer object in Excel VBA. 4 21
The canonical version of this article is on my web site here: http://iconoun.com/articles/collisions/ A companion presentation is available here: http://iconoun.com/articles/collisions/Unicode_Presentation.pdf
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now