Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-23-2014, 09:36 AM
gbaker gbaker is offline Need help with Index formula Windows 7 32bit Need help with Index formula Office 2010 32bit
Competent Performer
Need help with Index formula
 
Join Date: May 2012
Posts: 111
gbaker is on a distinguished road
Default Need help with Index formula


Hello All,
I need some help with a formula. I think it should be and INDEX function but I'm not sure. I want to look up every instance of the Sponsor in the table attached and show the Date Dropped and Quantity for the results. Haven't been able to make it work using VLookup or Index. Can you show me a formula that will work?
Attached Files
File Type: xlsx Index test.xlsx (21.6 KB, 12 views)
Reply With Quote
  #2  
Old 01-23-2014, 11:27 AM
BobBridges's Avatar
BobBridges BobBridges is offline Need help with Index formula Windows 7 64bit Need help with Index formula Office 2010 32bit
Expert
 
Join Date: May 2013
Location: USA
Posts: 700
BobBridges has a spectacular aura aboutBobBridges has a spectacular aura about
Default

If I understand what you mean, gbaker, the correct answer is this: No matter what lookup function you use—VLOOKUP, MATCH, INDEX, whatever—the function is going to return a single value that can go only in that one cell. If you want multiple values, you have to use multiple formulae, one in each cell.

I've attached your workbook, modified to accomplish that. I didn't bother to use IF(ERROR...) functions so it looks messy, and someone else here may be able to show a better way of doing it generally. And of course you can always write a macro, though there may be reasons why that isn't a practical solution. This works...sort of.
Attached Files
File Type: xlsx x.xlsx (24.3 KB, 15 views)
Reply With Quote
  #3  
Old 01-30-2014, 01:17 PM
gbaker gbaker is offline Need help with Index formula Windows 7 32bit Need help with Index formula Office 2010 32bit
Competent Performer
Need help with Index formula
 
Join Date: May 2012
Posts: 111
gbaker is on a distinguished road
Default Need help with Index formula

Hi Bob,
Was able to make this work. I also tried to do it with another table. I wanted to have the date be the lookup. I moved the date column over to the 1st column and changed the formula but it didn't work. Should this also work if a date is being looked up.
Reply With Quote
  #4  
Old 01-30-2014, 02:24 PM
BobBridges's Avatar
BobBridges BobBridges is offline Need help with Index formula Windows 7 64bit Need help with Index formula Office 2010 32bit
Expert
 
Join Date: May 2013
Location: USA
Posts: 700
BobBridges has a spectacular aura aboutBobBridges has a spectacular aura about
Default

Yeah, VLOOKUP and MATCH can use dates just as well as string values. Post a copy of the worksheet that doesn't work and I'll take a look at it.
Reply With Quote
  #5  
Old 01-31-2014, 11:23 AM
gbaker gbaker is offline Need help with Index formula Windows 7 32bit Need help with Index formula Office 2010 32bit
Competent Performer
Need help with Index formula
 
Join Date: May 2012
Posts: 111
gbaker is on a distinguished road
Default Need help with Index formula

Hi Bob,
I have attached a sample of what I am trying to do!!!
Attached Files
File Type: zip microsoft lookup date test.zip (80.7 KB, 10 views)
Reply With Quote
  #6  
Old 02-01-2014, 07:47 PM
BobBridges's Avatar
BobBridges BobBridges is offline Need help with Index formula Windows 7 64bit Need help with Index formula Office 2010 32bit
Expert
 
Join Date: May 2013
Location: USA
Posts: 700
BobBridges has a spectacular aura aboutBobBridges has a spectacular aura about
Default

I see the problem. You're searching for a particular date in a column that has dates and times; there's no exact match.

Here's why: The timestamp "2014-01-15 22:39:23" is stored in Excel as 41654.9440162037. That's 41654 days from 1900-01-01 — which gets you to the end of 2014-01-14 — plus .9440162037 of another day, which gets you to 22:39:23 of the next day. Never mind that it looks like a year, month, day and time; the format code tells Excel to display it that way, but the internal value is one single large number.

So here you come along and ask the MATCH function to find 2014-01-15. But what Excel sees is 41654—that is, 41654.000—and when it tries to find 41654 in Master-date!B:B, it doesn't see anything that matches than value exactly.

So what do you do about it? Well, here's one way: I created a new column in in Master-date!I:I with formula =INT(B2). This takes the date from column B and throws away the fractional part; what's left is not a date and time, but just the date part. Then I changed the formula in 'Lookup by Date'!H:H to point to column I in Master-date instead of column B, like this:
Code:
=MATCH(R3C3,OFFSET('Master-date'!R1C9:R172C9,R[-1]C,0),0)+R[-1]C
...Oops; I use R1C1 notation by habit. I mean it looks like this:
Code:
=MATCH($C$3,OFFSET('Master-date'!$I$1:$I$172,H7,0),0)+H7
I didn't check for any other errors, but the table all filled in, when I did that, with valid-looking data.

One thing: In column H of 'Lookup by Date', when I made that change, Excel displayed that column of row numbers as dates, eg "5-22". That means row 142, for the reason I explained above. The lookup and the rest of the table works fine, it just looks strange. All you have to do is changed the format of that column to General and it returns to normal.
Reply With Quote
  #7  
Old 02-02-2014, 07:37 AM
Pecoflyer's Avatar
Pecoflyer Pecoflyer is offline Need help with Index formula Windows 7 64bit Need help with Index formula Office 2010 64bit
Expert
 
Join Date: Nov 2011
Location: Brussels Belgium
Posts: 2,779
Pecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant future
Default

@gbaker

Looking at your wbk I noticed that on the first sheet the date to be searched is placed in a merged cell.
Although it looks nice, if you have to work with it it could and will get you in trouble. So, except for purely cosmetic purposes, avoid using merged cells. Youcan replace then with the horizontal format " Center across selection" which does not have these drawbacks.

I'm also wondering why you do not simply use a filter on the date in you second sheet. Hit AltD+F+F and you can filter any day you want, or by sponsor, or whatever.
__________________
Did you know you can thank someone who helped you? Click on the tiny scale in the right upper hand corner of your helper's post
Reply With Quote
  #8  
Old 02-07-2014, 06:34 AM
gbaker gbaker is offline Need help with Index formula Windows 7 32bit Need help with Index formula Office 2010 32bit
Competent Performer
Need help with Index formula
 
Join Date: May 2012
Posts: 111
gbaker is on a distinguished road
Default

Hi Bob,
That worked perfectly. Thanks for the Help!!!
Pecoflyer,
I took you advise and got rid of the merged cell. Both functions have value so I did as Bob suggested and also used the filter which is also a helpful tool for the team.

Thanks again!!!
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Complex Formula using INDEX and Match needed OTPM Excel 5 05-23-2013 01:22 AM
Adding an Index savo Word 1 04-17-2013 06:16 PM
Help with multiple match and index formula ryanwood Excel 1 09-12-2012 07:53 AM
Need help with Index formula Complexed Index elistein Word 1 05-01-2011 06:04 PM
Find and Index cksm4 Word 1 01-03-2011 11:33 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:33 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft