Question

Look up cells in ranges

Asked by: mjpalma

I have two similar problems.  The situation is I have a a web query that returns data to a blank worksheet, but data is returned to different places on the worksheet, usually within the same column, but at different rows.  This problem is due to the web page and if it has an advertisement, this occurs randomly so there is no way to use an absolute reference to the needed data points.  There is nothing I can do about this, and since of the data is returned by the query in pairs, one cell is a label and an adjacent cell is a data point, so as a solution I am using a index/match formula to find the data points I need.  But there are two exceptions that I need help dealing with:

1- one data point is a cell that contains the following text "web site: " and then a URL.  Since there is no adjacent cell I can use, and because its row may vary, I have been trying to find a function/formula that could find the specific cell with the  "web site:" text and then return all the text for the cell, including the URL.  Then I can use MID function to extract the URL

2- There are several instances where the label is in a cell on one row and the data point is on another row in the same column.  The HLOOKUP function does not seem to work becuase the row of the label varies.

Any help would be much appreciated.

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2004-11-05 at 21:49:33ID21196896
Topic

Microsoft Excel Spreadsheet Software

Participating Experts
4
Points
400
Comments
15

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. copying a formula to adjacent cells with?
    Hi, try this: type the numbers 1,2,3,4,5,6,7,8,9 etc. into the cells C1, D1, E1, F1, G1 etc. Select cell D2 and enter the formula =G1 then move one to the right and enter =F1. Now select both G1 and F1, grab the fill handle and drag to the right. The result is: 5, 4, 7, 6...
  2. Add a formula to a cell only if two adjacent cells are populated
    I need to concatenate Cells A1 and B1 and put the result in C1. I need to do this everytime I add a new record. For example if I add an employee and put his last name in cell A1 and first name in B1 then I want to concatenate the two in C1. I need column C to grow as colum...
  3. One cell on a worksheet reference the last cell in a range o…
    In the attached workbook there is a worksheet named Title. In the cell range G25:M25 I would like to reference the last cell with text on the worksheet Version History in column C. The worksheet Version History is used to track who updated the spreadsheet last and when the u...
  4. Excel Formula:  Conditionally format cell based on adjacent…
    Greetings Experts, I need some help with a formula I can use to determine whether an adjacent cell displays Y or N. The formula cannot use hard coded cell values. It needs to take the current cell and look to the right one cell for the value (if that makes sense). So it l...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: byundtPosted on 2004-11-05 at 21:58:33ID: 12511698

Hi mjpalma,
For question number 1, consider using an array formula like this:
=INDEX(D:D,MIN(IF(NOT(ISERROR(SEARCH("web site:",D1:D500))),ROW(D1:D500),"")),1)       Array formula, so hold the Control + Shift keys down while pressing Enter. Excel should respond by adding curly braces { } surrounding the formula.
This formula is case insensitive, and will return the entire contents of the first cell in column D containing the text "web site:"

Cheers!

Brad

 

by: brettdjPosted on 2004-11-05 at 22:00:23ID: 12511702

Hi mjpalma,

If you know the web site then you could use a VLOOKUP

Cheers

Dave

 

by: ShaneDevenshirePosted on 2004-11-05 at 22:04:40ID: 12511711

Hi,

For your first problem you could use:

=SUBSTITUTE(OFFSET(A1,MATCH("Web Site:*",A1:A16,0)-1,0),"Web Site: ","")

Where the data comes in anywhere in the range A1:A16 and the leading text is "Web Site: ".  The above function actually does both of the things you want to do - it finds the cell and extracts the url all in one formula.

Fro your second problem:

Your problem here is not clear - are you trying to return the URL as in the previous case?  Is the URL in a cell by itselft?  When you say "data point" what do you mean?

Shane Devenshire

 

by: brettdjPosted on 2004-11-05 at 22:19:57ID: 12511750

sorry, I started posting to this one and then I stopped part way through when I saw Brad's answer. I must have hit submit when closing the window

My first suggestion was VLOOKUP which was included

The second part which I hadn't added was using a find routine, my example used SUMPRODUCT to avoid using an array formula
=MAX(IF(NOT(ISERROR(SEARCH("web site",A1:A10))),ROWS(1:10),0))
which assumes there is only 1 valid match to be found

but Shane's wildcard MATCH is a better approach

Cheers

Dave

 

by: brettdjPosted on 2004-11-05 at 22:22:58ID: 12511758

hmmm...bad copy and paste. This was my aborted SUMPRODUCT to work on A1:A10

=SUMPRODUCT(--(NOT(ISERROR(FIND("web site",A1:A10)))),ROW(1:10))

exiting question :)

Cheers

Dave

 

by: ShaneDevenshirePosted on 2004-11-05 at 22:44:45ID: 12511807

Hi again,

If you just want the locatin of the item use only the portion of my suggestion that reads:

 MATCH("Web Site:*",A1:A16,0)

If you just want to return the contents of that entry then use just this part:

OFFSET(A1,MATCH("Web Site:*",A1:A16,0)-1,0)

But if you want to return the URL from the cell without have separate formulas then use the whole thing, it saves you doing a MID function although you could do that also:

=SUBSTITUTE(OFFSET(A1,MATCH("Web Site:*",A1:A16,0)-1,0),"Web Site: ","")

=MID(OFFSET(A1,MATCH("Web Site:*",A1:A16,0)-1,0),11,200)

The "11" argument will depend on how long the leading text in front of the URL is.  The "200" is just a large enough number to catch any length url.

Shane Devenshire

 

by: mjpalmaPosted on 2004-11-05 at 23:42:45ID: 12511910

All, thanks for the fast responses, I used Shane's
=SUBSTITUTE(OFFSET(A1,MATCH("Web Site:*",A1:A16,0)-1,0),"Web Site: ","") solution, and it worked perfectly.

For the second problem let me rephrase it, since there was some confusion:

where ? = row number,
Where ? can vary from row 7 to 12 so far (it may vary in a wider range but I have not seen that yet)

Starting in cell A?- there is a table of 7 rows and 9 columns that I am trying to retrieve
Here is an example, "Company" is located in cell A?

A?                     B?           C?         D?         E?             F?            G?             H?                     I?
Company                        Symbol      Price      Change      Market Cap        P/E
Automatic Data Processing Inc            ADP      44.75      1.40%      26.07B              28.11
Accenture Ltd                  ACN      25.13      1.99%      23.29B              20.65
Paychex Inc                  PAYX      33.31      1.65%      12.60B              40.72
Moody's Corp                  MCO      79.8      0.03%      11.79B              32.16
Reuters Group PLC                  RTRSY      41.19      1.01%      9.83B              15.95
Gartner Group Inc                  IT      11.69      0.09%      1.57B              83.5

Columns b,c,d are empty

the header row, starting with "Company" is always present, so if I can use that row for a reference point, what I need is a formula that searches for the cell with the header text and then reurns the approriate cell below the reference cell.

HLookup did not work because the row numbers may change, the same with offset so far.  I tried nexting both within an index and a match function formula, neither worked.

Again thanks for the quick response and I am grateful for the help

 

by: ShaneDevenshirePosted on 2004-11-06 at 00:10:42ID: 12511967

So out of the sample data which item do you want to find?  Please give us a specific example of the desired return value using the sample data you posted.

For example I want to find Moody's Corp's P/E  ----> 32.16

Let's assume that is what you want to do, then enter the Company you want in cell A1 and the Item you want in cell B1, in C1 enter the formula:

=OFFSET(A6,MATCH(A1,A7:A12,0),MATCH(B1,B6:I6,0))

Shane Devenshire

 

by: mjpalmaPosted on 2004-11-06 at 00:36:48ID: 12512077

Sure, an example is I want to find the third company name in the list.  I know that "Company" will always be returned by the query, the list of companies will change based on which web page I query. So, in this case, Paychex Inc is the third company.  If I query a different web page, the third company on this list may be Ford.  So I cannot just look for ford.  

At the same time, the header row will change, so I need a formula that will find the right cells anywhere on the work sheet.  I tried your formula above and it did not work, I think because there it needs a definite starting point.

So what I need for the formula to do is search column A for "Company", and then return the name of the third company on the list, "Paychex Inc." in this case, located 3 rows below which ever row "Company" is located.

thanks

 

by: jeveristPosted on 2004-11-06 at 08:09:07ID: 12513499

Hi mjpalma,

This will return the name of the third company after "Company" in column A:

=OFFSET(A1,MATCH("Company",A:A)+2,0,1,1)

In this case, "Paychex Inc.".

Jim

 

by: mjpalmaPosted on 2004-11-06 at 11:23:20ID: 12514239

Jim, I am having problems with your formula, its returning a value from further down column A than Paychex.  Specifically, "Company" is currently located in row 36 (keeping in mind this will change depending on the website being queried), the formula is returning the value for row 78.  Could the problem be related to the reference value "A1"?  

Thanks for your help and patience
Mike

 

by: byundtPosted on 2004-11-06 at 12:08:32ID: 12514373

mjpalma,
Try using a * after Company:
=INDEX(A:A,MATCH("Company*",A:A,0)+3)
Brad

 

by: mjpalmaPosted on 2004-11-06 at 13:23:25ID: 12514614

Brad, It worked perfectly, thanks to all of you
Mike

 

by: byundtPosted on 2004-11-06 at 13:30:09ID: 12514642

Mike,
In a multi-part question with input from a number of experts, it is common to split the points among several different experts. If you look at the top of the Comment box, there is a link for "Split Points". If you wouldn't mind, I am going to reopen the question so you can try this feature out.
byundt--Excel TA Page Editor

 

by: byundtPosted on 2004-11-06 at 16:41:36ID: 12515262

Mike,
Thanks for being such a good sport.
Brad

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...