Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default macro for coding an id number


Hi,

I`ve created this simple sample index to code items using a vlookup:

id code item
1001 apples
7771 oranges
4432 pears
6767 bananas
2722 strawberries

This works using a two column array for the index and data which I`d
like to code.

Unfortunately, the items are more complex and would really need more
than a two column array. Ideally, the reference index needs to be
multiple columns such as:

idcode item origin size color
1001 apples USA large red
1002 apples USA large green
1003 apples USA large yellow
3234 apples Spain large red
3235 apples Spain large green
3236 apples Spain large yellow
7771 oranges France small
7772 oranges France medium
7773 oranges France large
2425 oranges USA small
2426 oranges USA medium
2427 oranges USA large

Is there some way to do a vlookup using a multi-column array to code the
items? If the items meets all of the criterion for item, origin, size
and color - then it codes the corresponding idcode.

The dataset with the items to be coded have the same field headings as
above. All that is missing is the idcode.

Is there some way to adjust the VB code for a simple vlookup procedure
to do this? How would be the most effective way to do this?

Looking forward to your suggestions.

Best regards,

Matthew Kramer





*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default macro for coding an id number

The only pattern I see is if item and origin are the same use the same first
three digits.

Any other rules.

--
Regards,
Tom Ogilvy

"Matthew Kramer" wrote in message
...

Hi,

I`ve created this simple sample index to code items using a vlookup:

id code item
1001 apples
7771 oranges
4432 pears
6767 bananas
2722 strawberries

This works using a two column array for the index and data which I`d
like to code.

Unfortunately, the items are more complex and would really need more
than a two column array. Ideally, the reference index needs to be
multiple columns such as:

idcode item origin size color
1001 apples USA large red
1002 apples USA large green
1003 apples USA large yellow
3234 apples Spain large red
3235 apples Spain large green
3236 apples Spain large yellow
7771 oranges France small
7772 oranges France medium
7773 oranges France large
2425 oranges USA small
2426 oranges USA medium
2427 oranges USA large

Is there some way to do a vlookup using a multi-column array to code the
items? If the items meets all of the criterion for item, origin, size
and color - then it codes the corresponding idcode.

The dataset with the items to be coded have the same field headings as
above. All that is missing is the idcode.

Is there some way to adjust the VB code for a simple vlookup procedure
to do this? How would be the most effective way to do this?

Looking forward to your suggestions.

Best regards,

Matthew Kramer





*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default macro for coding an id number

How about creating a new column comprised of a concatenation of the
item&origin&size&color:
Assuming your data starts in B4, the first formula in cell A4 would be:
=C4&D4&E4&F4

You could then use column A as your lookup column. Something like,
=VLOOKUP("applesUSAlargered",A4:F15,2,FALSE)

Regards,
Phil Webb


"Matthew Kramer" wrote in message
...

Hi,

I`ve created this simple sample index to code items using a vlookup:

id code item
1001 apples
7771 oranges
4432 pears
6767 bananas
2722 strawberries

This works using a two column array for the index and data which I`d
like to code.

Unfortunately, the items are more complex and would really need more
than a two column array. Ideally, the reference index needs to be
multiple columns such as:

idcode item origin size color
1001 apples USA large red
1002 apples USA large green
1003 apples USA large yellow
3234 apples Spain large red
3235 apples Spain large green
3236 apples Spain large yellow
7771 oranges France small
7772 oranges France medium
7773 oranges France large
2425 oranges USA small
2426 oranges USA medium
2427 oranges USA large

Is there some way to do a vlookup using a multi-column array to code the
items? If the items meets all of the criterion for item, origin, size
and color - then it codes the corresponding idcode.

The dataset with the items to be coded have the same field headings as
above. All that is missing is the idcode.

Is there some way to adjust the VB code for a simple vlookup procedure
to do this? How would be the most effective way to do this?

Looking forward to your suggestions.

Best regards,

Matthew Kramer





*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default macro for coding an id number


Phil,

Thanks for the idea.

Matthew


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
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
HELP - coding on Macro! Eric Excel Worksheet Functions 3 February 21st 08 12:26 AM
coding macro Boss Excel Discussion (Misc queries) 0 November 13th 07 12:17 PM
color coding custom number formats bob sacco Excel Discussion (Misc queries) 1 October 3rd 05 01:01 PM
color coding custom number formats bob sacco Excel Discussion (Misc queries) 2 October 3rd 05 11:58 AM
Need VB Coding Help for a Macro Tom Ogilvy Excel Programming 0 August 26th 04 08:46 PM


All times are GMT +1. The time now is 12:56 AM.

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

About Us

"It's about Microsoft Excel"