![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Apr 2002
Location: Dublin, Ireland
Posts: 51
|
Hi there!
I have three worksheets for my golf sociey: Outing1 Outing2 Outing3 Each worksheet contains points won by each player in each event. On worksheet "Outing3", I want to lookup the points accumulated by each player to dat. This I can do. My problem is where a player played in outing1 but missed outing2. The lookup in outing3 will return the result "#N/A" as it finds nothing in worksheet "outing2". Where the lookup finds "#N/A", I need it to lookup the previous outing to search for a result. How do I do this? I imagine it uses a coctail of "if", "vlookup" and "isnumber" statements. Note that although I've used 3 workbooks for illustration, the actual file contains worksheets for 7 outings. Thanks for any help you can give! |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Allentown, PA
Posts: 2,510
|
Just before your vlookup, do this IF
=If(ISNA(VLOOKUPFORMULA),True,VLOOKUPFORMULA) True = What you want it to do if it IS returning #N/A
__________________
~Anne Troy |
|
|
|
|
|
#3 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
|
Quote:
This is a bit unclear (to me). It looks like you're looking for a value in the latest "Outing" first. If that's not successfull,then you want to look in the one before the latest. Any comments? |
|
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Apr 2002
Location: Dublin, Ireland
Posts: 51
|
Aladin, your interpretation is exactly correct (sorry if I was not clear enough).
Dreamboat, I'm going to check out your suggestion now... |
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Apr 2002
Location: Dublin, Ireland
Posts: 51
|
Dreamboat, your solution works like a dream (excuse the sad pun!) for the 3 outings noted in my query.
To finish this solution off, you'll remember I mentioned that there are in fact 7 outings in total. In the worksheet for outing7, I'll need your formula to refernce back to the previous outing, moving back as far as outing1 where "#N/A" is returned in later outings. How would you propose I structure your formula to accommodate these additional lookups? Thanks! |
|
|
|
|
|
#6 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
|
Quote:
Probably a VBA code that goes thru all your tables would be more effective. A possible formula-based approach consists of naming all tables one by one like Outing1, Outing2, etc. In an Overview sheet you might consider a layout as shown in the figure below: You can see the formula of cells only click each above hyperlinks The above image was automatically written by HtmlMakerVer1.12 If you want this code, click here and Colo will email the file to you. You can hide the colored columns. B2 houses the following array-formula which is copied downwards: =IF(COUNT(C2:G2),OFFSET(C2,0,MIN(IF(ISNUMBER(C2:G2)*COLUMN(C2:G2),ISNUMBER(C2:G2)*COLUMN(C2:G2)))-3,1,1),"") C2 houses a VLOOKUP formula which is copied across then down: =VLOOKUP($A2,INDIRECT(C$1),2,0) C1 to G1 houses the table names from the latest to the earliest. Aladin |
|
|
|
|
|
|
#7 |
|
Board Regular
Join Date: Apr 2002
Location: Dublin, Ireland
Posts: 51
|
My workbook is fully functional now. Thanks very much guys!
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|