Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Can a vlookup be done on a 2 dimensional array?

I've never worked with VBA arrays before, and it's been many years since I
used them in a spreadsheet. Now I think they might help.

I have a spreadsheet with unusual dates. They're in MMM-YY format (no
days). I need to somehow convert them to month and year to compare with
some "normal" dates which are in mm/dd/yy format. Is it possible to create
a 2 dimensional array using Jan to Dec and 1 to 12 and then do a lookup to
get from the "mmm" in the spreadsheet to the month number to compare to
the "mm" in the date in the other column? Or do I have to put the months
and numbers into the spreadsheet and do a regular vlookup to convert from
text month to numeric month?

Thanks for your help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,440
Default Can a vlookup be done on a 2 dimensional array?

<They're in MMM-YY format

Are they "real" Excel dates formatted asMMM-YY, or are they text strings?
If they are real Excel dates, just use FormatCellsNumber tabDate and
choose an appropriate format.
If they are text strings, it depends on your date settings in Windows
Control Panel. Anyway, do try the DATEVALUE() function.
You can test whether it is a text string with the ISTEXT() function or the
other way around with the ISNUMBER() function (dates are numbers in Excel).
Last try indeed, use VLOOKUP tables. IŽd be surprised if that proved to be
necessary, but who knows.........


--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"davegb" wrote in message
.. .
I've never worked with VBA arrays before, and it's been many years since I
used them in a spreadsheet. Now I think they might help.

I have a spreadsheet with unusual dates. They're in MMM-YY format (no
days). I need to somehow convert them to month and year to compare with
some "normal" dates which are in mm/dd/yy format. Is it possible to create
a 2 dimensional array using Jan to Dec and 1 to 12 and then do a lookup to
get from the "mmm" in the spreadsheet to the month number to compare to
the "mm" in the date in the other column? Or do I have to put the months
and numbers into the spreadsheet and do a regular vlookup to convert from
text month to numeric month?

Thanks for your help.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 219
Default Can a vlookup be done on a 2 dimensional array?

On Wed, 12 Nov 2008 00:07:49 +0100, Niek Otten wrote:

<They're in MMM-YY format

Are they "real" Excel dates formatted asMMM-YY, or are they text strings?
If they are real Excel dates, just use FormatCellsNumber tabDate and
choose an appropriate format.
If they are text strings, it depends on your date settings in Windows
Control Panel. Anyway, do try the DATEVALUE() function.
You can test whether it is a text string with the ISTEXT() function or the
other way around with the ISNUMBER() function (dates are numbers in Excel).
Last try indeed, use VLOOKUP tables. IŽd be surprised if that proved to be
necessary, but who knows.........


Thanks for your reply. I should have mentioned that the "MMM-YY" dates are
actually text, not XL dates. I tried the DATEVALUE function, but for some
reason, the cell showed =DATEVALUE(F3) instead of the XL datevalue. It does
show the numerical datevalue in the DATEVALUE function dialog box! Never
saw that before. I guess DATEVALUE won't work here.

You didn't reply to my question about using an array to do a lookup. Is
this a possible way to go?
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Can a vlookup be done on a 2 dimensional array?

You don't need a look up function... you can get the month number using a
formula like this...

=TEXT(--("1-"&A1),"m")

where I have assumed the MMM-YY "date" is in A1.

--
Rick (MVP - Excel)


"davegb" wrote in message
.. .
I've never worked with VBA arrays before, and it's been many years since I
used them in a spreadsheet. Now I think they might help.

I have a spreadsheet with unusual dates. They're in MMM-YY format (no
days). I need to somehow convert them to month and year to compare with
some "normal" dates which are in mm/dd/yy format. Is it possible to create
a 2 dimensional array using Jan to Dec and 1 to 12 and then do a lookup to
get from the "mmm" in the spreadsheet to the month number to compare to
the "mm" in the date in the other column? Or do I have to put the months
and numbers into the spreadsheet and do a regular vlookup to convert from
text month to numeric month?

Thanks for your help.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 219
Default Can a vlookup be done on a 2 dimensional array?

On Tue, 11 Nov 2008 18:42:03 -0500, Rick Rothstein wrote:

=TEXT(--("1-"&A1),"m")


Thanks, Rick!
Reply
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
Export 1-dimensional array values to a two-dimensional table? Laurie Excel Programming 2 November 8th 07 03:51 PM
Changing a two-dimensional, one row array to one-dimensional Alan Beban[_2_] Excel Programming 1 September 16th 07 08:56 PM
Returning an array from a multi-dimensional array Chris Excel Programming 2 January 3rd 07 06:01 AM
Mutli-dimensional Array to Single-Dimension Array Blue Aardvark Excel Programming 3 October 15th 05 09:22 AM
Create One-Dimensional Array from Two-Dimensional Array Stratuser Excel Programming 1 February 23rd 05 08:46 PM


All times are GMT +1. The time now is 03:02 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"