LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Parsing cell formula to return associated value

I have 2 sheets in my workbook. Sheet1 is a stock list (item and price in
adjacent column):

A B
1 Screen 200
2 Speakers 50
3 Keyboard 20
etc.

Sheet2 contains items manually selected from Sheet1 in column A:

A B
1 =Sheet1!A1 ??
2 =Sheet1!A99 ??

I want B1 on Sheet2 to contain the price associated with the formula in A1.
I can't do a straightforward drag cell formula from A1 to B1 (to get
=Sheet1!B1) because the user can change the cell reference in A1 and I want
B1 to automatically update with the correct price. Similarly B2 should
contain the price associated with the formula in A2.

I think this requires a user-defined function, e.g. B1 would contain
=getPrice(A1).

Function getPrice(itemCell As range) As Integer
item = itemCell.Formula
End Function

and parse the formula to get the price from Sheet1, same row, column+1, but
don't know how to proceed. Any help much appreciated. Cheers.


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formula/Function for parsing data Nadine Excel Worksheet Functions 5 April 1st 10 08:46 PM
parsing a formula... Dave F[_2_] Excel Discussion (Misc queries) 3 August 25th 07 12:20 AM
parsing a cell using | exceluser2 Excel Worksheet Functions 4 February 24th 06 07:23 AM
Name parsing formula.. Matt Williamson Excel Programming 6 December 16th 04 11:17 PM
Parsing Data w/ a Formula (another question) carl Excel Worksheet Functions 2 December 3rd 04 06:51 PM


All times are GMT +1. The time now is 06:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"