View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Roger Govier Roger Govier is offline
external usenet poster
 
Posts: 2,886
Default Find Column Number via Lookup

Hi Ryan

Depending upon whether you are wanting Current or Previous, could you
not use a formula in B4 which returned either May or April.
Or, if B4 is your dropdown selecting the month, use cell C4 to make that
April or May depending upon whether you have selected Previous? Then use
C4 in your formula rather than B4.

Better still, take the second Vlookup out of your formula altogether.
In C4
=IF(xxx="Previous",OFFSET(VLOOKUP($B$4,$BJ:$BK,2,F ALSE),-1,0),
VLOOKUP($B$4,$BJ:$BK,2,FALSE))
where xxx represents a cell determining Current or Previous

Then your main formula becomes
=VLOOKUP(CONCATENATE($A17,C$16),'2007'!$B:$HL,$C$4 ,FALSE)

--
Regards

Roger Govier


"Ryan" wrote in message
ups.com...
Hi All,

I appreciate your replies. I realize that the number of cells vs days
in the year + weekly & monthly totals are more than the allotted
amount in excel. We only do business certain months of the year, so
it's less than A:HL (thank goodness!). Also, it's column number 28
due to the range I selected; I have a some labels in the first few
columns of the spreadsheet which throws off my lookup if I select
them.

I figured out how to search for the text of the Month label (April 07,
May 07, etc).

My only outstanding question is:

I choose a Month from my drop-down list (Validation) & I have a
VLOOKUP looking up the month from the validation list & pulling the
value from the selected column in a VLOOKUP (formula below). However,
I want to show "previous month", "current month" and "ytd" -- Current
Month & YTD are working fine, but I am having trouble directing the
VLOOKUP to find "May 07" and then pull the value in column 2, -1 row.

This is my current formula:
=VLOOKUP(CONCATENATE($A17,C$16),'2007'!$B:$HL,(VLO OKUP($B$4,$BJ:$BK,
2,FALSE)),FALSE)

The part that I'm confused about, is the 2nd VLOOKUP in the formula.
The '2' returns the column numbers for the results I want, and this
works wonderfully for current & ytd numbers. How do I direct the '2'
to actually pull from column 2 & -1 row?

Thanks again for all of your help -- I'm a beginner & am trying to
teach myself! :)

Thanks,
Ryan