Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-14-2012, 11:36 AM
jyfuller jyfuller is offline Vlookup help for large amounts of stock data Windows 7 64bit Vlookup help for large amounts of stock data Office 2007
Advanced Beginner
Vlookup help for large amounts of stock data
 
Join Date: Jun 2012
Posts: 32
jyfuller is on a distinguished road
Default Vlookup help for large amounts of stock data

Hi. I am trying to create a formula to lookup data based on the name of a stock. I have Buy data of stocks that have been bought on a certain date and sell data, which shows when the shares that were bought have been sold. SALES OF STOCK ARE BOUGHT AND SOLD ON THE SAME DAY. I want the formula to lookup a symbol from the buy data, find the name (symbol) of the stock in the sell data and return the price of the stock in the row that corresponds to that symbol.

The formula I have made is as follows: vlookup(Apple,A1:F100,3,FALSE). That is the formula will lookup apple in the range a1:f100 and bring back data from the third column, which is price, in the row that it finds Apple. I copy and paste this formula in a separate column, referring to the buy data symbols for the stock as the (lookup) value, so the formula will look up symbols it finds in the buy data and search in the "sell" data range and column values.

I have a problem when applying this formula. The formula finds the stock symbol in the sell data and returns a price, but there are several shares of apple each with a different price sold on different dates. The formula automatically searches for the first Apple stock it finds and brings back the price from that day, which is NOT necessarily the same price on the day in which it was sold. The formula automatically assumes that the first sale of apple it finds is the price that I am looking for, when in fact sales of stock on different dates have different prices. For example I want a buy on January 10, which is sold on January 10, to come back with a sales price on January 10. The vlookup formula will find the first Apple stock it finds and input the corresponding price column. Is there a way to search using vlookup that will find me the price of the stock corresponding to each date? I tried using IF statements and I still cannot get the right formula. Let me know. Thanks.
Reply With Quote
  #2  
Old 09-14-2012, 07:30 PM
excelledsoftware excelledsoftware is offline Vlookup help for large amounts of stock data Windows 7 64bit Vlookup help for large amounts of stock data Office 2003
IT Specialist
 
Join Date: Jan 2012
Location: Utah
Posts: 455
excelledsoftware will become famous soon enough
Default

This should be no problem. Could you supply us with a sample sheet. I am thinking you will need to utilize a couple different reference cells to make this work for sure but let's start with sample sheet.
Reply With Quote
  #3  
Old 09-17-2012, 08:14 AM
jyfuller jyfuller is offline Vlookup help for large amounts of stock data Windows 7 64bit Vlookup help for large amounts of stock data Office 2007
Advanced Beginner
Vlookup help for large amounts of stock data
 
Join Date: Jun 2012
Posts: 32
jyfuller is on a distinguished road
Default Thank you. I need to send you the file

Hi excelledsoftware,

I will send out the file later today as I am at work, probably around 6 or 7pm. Again I need to use vlookup to search for stock names in a "sell" table using names in the "buy" table to return the price column corresponding to the stock in the "sell" data. There are several stocks of the same name in the sell table, all on different dates with different prices. Vlookup brings back the most recent stock name with corresponding price column, which causes stocks to have the most recent price, not the price that corresponds to the date when it was sold. I need the stock corresponding to a certain buy date to have the correct sell price.

Thank you for the quick reply. Cheers!
Reply With Quote
  #4  
Old 09-17-2012, 09:34 AM
Pecoflyer's Avatar
Pecoflyer Pecoflyer is offline Vlookup help for large amounts of stock data Windows 7 64bit Vlookup help for large amounts of stock data Office 2010 64bit
Expert
 
Join Date: Nov 2011
Location: Brussels Belgium
Posts: 2,767
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

Does the attached help?

be aware that the formula is an array formula to be committed with Ctrl+Shift+Enter
Attached Files
File Type: xlsx Example Sheet.xlsx (10.7 KB, 13 views)
__________________
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
  #5  
Old 09-18-2012, 09:56 PM
excelledsoftware excelledsoftware is offline Vlookup help for large amounts of stock data Windows 7 64bit Vlookup help for large amounts of stock data Office 2003
IT Specialist
 
Join Date: Jan 2012
Location: Utah
Posts: 455
excelledsoftware will become famous soon enough
Default

Quote:
Originally Posted by Pecoflyer View Post
Does the attached help?

be aware that the formula is an array formula to be committed with Ctrl+Shift+Enter
Here is my suggestion to fix the issue you are having. See the edits I made in blue. You could write the formula in column A all the way down and then hide column A then the edited formula would work no problem.

Let me know if this fixes the issue or if you need a different route.

Thanks
Attached Files
File Type: xlsx Example Sheet edited 9-18-12.xlsx (10.3 KB, 12 views)
Reply With Quote
  #6  
Old 09-19-2012, 04:58 AM
Pecoflyer's Avatar
Pecoflyer Pecoflyer is offline Vlookup help for large amounts of stock data Windows 7 64bit Vlookup help for large amounts of stock data Office 2010 64bit
Expert
 
Join Date: Nov 2011
Location: Brussels Belgium
Posts: 2,767
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

@excelledsoftware Any reason why you quoted my post ?
__________________
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
  #7  
Old 09-19-2012, 05:49 PM
excelledsoftware excelledsoftware is offline Vlookup help for large amounts of stock data Windows 7 64bit Vlookup help for large amounts of stock data Office 2003
IT Specialist
 
Join Date: Jan 2012
Location: Utah
Posts: 455
excelledsoftware will become famous soon enough
Default

Quote:
Originally Posted by Pecoflyer View Post
@excelledsoftware Any reason why you quoted my post ?
@Pecoflyer.

LOL really sorry about that I was thinking that your post was the originator. so no reason I just goofed. Sorry
Reply With Quote
  #8  
Old 09-19-2012, 05:50 PM
excelledsoftware excelledsoftware is offline Vlookup help for large amounts of stock data Windows 7 64bit Vlookup help for large amounts of stock data Office 2003
IT Specialist
 
Join Date: Jan 2012
Location: Utah
Posts: 455
excelledsoftware will become famous soon enough
Default

Is the issue resolved with one of the attachments?
Reply With Quote
  #9  
Old 09-20-2012, 07:18 PM
jyfuller jyfuller is offline Vlookup help for large amounts of stock data Windows 7 64bit Vlookup help for large amounts of stock data Office 2007
Advanced Beginner
Vlookup help for large amounts of stock data
 
Join Date: Jun 2012
Posts: 32
jyfuller is on a distinguished road
Default

Hi excelled Software,

I just got to your post, sorry. I am getting my MBA and working full time and just looked now. Ive had no time.

I really like the simplicity of the lookup formula you added by adding a formula to convert the date into a number date from 1900 followed by a symbol to differentiate it from the other symbols. It worked well for the data I am trying to use in my excel file. Thank you!

The other formula that uses Index and Match though; I don't understand the other formula and it is not working. The formula says #N/A, and does not come up with a value. However, I can see that it could work with the logic behind it. Let me know if that second formula can be rearranged. It may be useful because I wouldn't need to create a reference column. I think your attached files have both formulas. Thanks again.
Reply With Quote
  #10  
Old 09-20-2012, 07:20 PM
jyfuller jyfuller is offline Vlookup help for large amounts of stock data Windows 7 64bit Vlookup help for large amounts of stock data Office 2007
Advanced Beginner
Vlookup help for large amounts of stock data
 
Join Date: Jun 2012
Posts: 32
jyfuller is on a distinguished road
Default

Hi Pecoflyer,

Thank you for responding. The formula appears to show me #N/A. I am not sure why it is giving me that result. The formula is good, but it is not working for some reason. Can you walk me through briefly what the formula is doing? Thanks.
Reply With Quote
  #11  
Old 09-20-2012, 11:16 PM
Pecoflyer's Avatar
Pecoflyer Pecoflyer is offline Vlookup help for large amounts of stock data Windows 7 64bit Vlookup help for large amounts of stock data Office 2010 64bit
Expert
 
Join Date: Nov 2011
Location: Brussels Belgium
Posts: 2,767
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

Difficult to be sue without seeing your data. Did you commit the formula with Ctrl+Shift+Enter ?
__________________
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
  #12  
Old 09-21-2012, 05:53 AM
jyfuller jyfuller is offline Vlookup help for large amounts of stock data Windows 7 64bit Vlookup help for large amounts of stock data Office 2007
Advanced Beginner
Vlookup help for large amounts of stock data
 
Join Date: Jun 2012
Posts: 32
jyfuller is on a distinguished road
Default Help with sorting dates

Thanks. It works now

I cannot sort these dates. I separated them with text in the form date---stock symbol (11/12/2012---jonny321) using mid(MID(F2,1,FIND("---",F2,1)-1)) to only have the date in the cell. For some reason excel is not interpreting the cell as a date anymore. Is there a way for me to convert the current cells back into date form so they can be sorted?
Attached Files
File Type: xlsx Help for Sorting dates.xlsx (8.6 KB, 8 views)
Reply With Quote
  #13  
Old 09-21-2012, 05:54 AM
jyfuller jyfuller is offline Vlookup help for large amounts of stock data Windows 7 64bit Vlookup help for large amounts of stock data Office 2007
Advanced Beginner
Vlookup help for large amounts of stock data
 
Join Date: Jun 2012
Posts: 32
jyfuller is on a distinguished road
Default

Thanks. It works now

I cannot sort these dates. I separated them with text in the form date---stock symbol (11/12/2012---jonny321) using mid(MID(F2,1,FIND("---",F2,1)-1)) to only have the date in the cell. For some reason excel is not interpreting the cell as a date anymore. Is there a way for me to convert the current cells back into date form so they can be sorted?
Attached Files
File Type: xlsx Help for Sorting dates.xlsx (8.6 KB, 12 views)
Reply With Quote
  #14  
Old 09-21-2012, 06:39 AM
Pecoflyer's Avatar
Pecoflyer Pecoflyer is offline Vlookup help for large amounts of stock data Windows 7 64bit Vlookup help for large amounts of stock data Office 2010 64bit
Expert
 
Join Date: Nov 2011
Location: Brussels Belgium
Posts: 2,767
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

To make things easy extract the dates again using
Code:
=MID(F2,1,FIND("---",F2,1)-1))*1
All dates will be coerced to real dates
__________________
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
  #15  
Old 09-21-2012, 07:39 AM
jyfuller jyfuller is offline Vlookup help for large amounts of stock data Windows 7 64bit Vlookup help for large amounts of stock data Office 2007
Advanced Beginner
Vlookup help for large amounts of stock data
 
Join Date: Jun 2012
Posts: 32
jyfuller is on a distinguished road
Default Ok

Excellent. It works now. Just for my knowledge: Why did it not recognize them as dates with the original formula? How does multiplying by 1 convert the cell into a number that excel recognizes as a date?

Thanks
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Vlookup help for large amounts of stock data indent alternate lines by different amounts rufusfrog Word VBA 5 02-25-2012 03:36 AM
Charting Help - Stock Prices Ligerdub PowerPoint 0 01-03-2012 04:59 AM
Stock levels RobertH Excel 5 01-24-2011 01:02 PM
Vlookup help for large amounts of stock data chart from large data set mcfie Excel 1 09-19-2010 03:11 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:16 PM.


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