#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Question

Hello Everybody,

here is what I am trying to do, below you can see a table including some
names and numbers,
as you see on samples (below the table) ,I need to write a VBA that can give
me some names from the table base in the input data
as you also see,from each part of the table I need the first largest number
after the input number.
is it possible to do that ? can any one help me or direct me to make such
VBA ?

Thanks in advance



================================================== ===============

name number

HD2A |2775
HD5A |4010
HD6A |5105
HD8A |7460
HD10A |9540
HD14A |11080
HD20A |11090
HD15 |15305
=======
PHD2 |3610
PHD5 |4685
PHD6 |5860
PHD8 |6730
=======
MSTC28 |2760
MSTC40 |3985
MSTC52 |4740
MSTC66 |5855
=======
HD2 |585
HD5 |890
HD6 |735
=======


Sample-1:
INPUT: 2800 - result: HD2A,PHD2,MSTC28

SAMPLE-2:
INPUT : 8545 - RESULT: HD10A

SAMPLE-3:
INPUT : 6325 - RESULT: HD8A,PHD6

SAMPLE-4:
INPUT : 1500 - RESULT: HD2A,PHD2,MSTC28,HD2A

SAMPLE-5:
INPUT : 300 - N/A (NOTHING)

SAMPLE-6:
INPUT : 20000 - OVER LIMIT


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Question

Hi

Try first to divide first column to types and categories
Like: HD 2A or PHD 2

then if you are familiar with vba algorythm should lokk like this(IMHO)-
input numer
Loop through first column,whenever type changes start the loop again for
new type,(HH,PHD,MSTC) compare results with third column

here I didnt understand either you mean nearest number or your examples
are not quite right.

so you compare with third column whenever the difference is smallest you
save in matrix

and then output it

by the way you could to it easier I think. again categorize them by HD
PHD and so on . make a pivot table based on this table. And use
criterias to filter and see data you want. (or simple auto macro)

*** Sent via Developersdex http://www.developersdex.com ***
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Question

Thanks Aram.

"Aram Sarsyan" wrote in message
...
Hi

Try first to divide first column to types and categories
Like: HD 2A or PHD 2

then if you are familiar with vba algorythm should lokk like this(IMHO)-
input numer
Loop through first column,whenever type changes start the loop again for
new type,(HH,PHD,MSTC) compare results with third column

here I didnt understand either you mean nearest number or your examples
are not quite right.

so you compare with third column whenever the difference is smallest you
save in matrix

and then output it

by the way you could to it easier I think. again categorize them by HD
PHD and so on . make a pivot table based on this table. And use
criterias to filter and see data you want. (or simple auto macro)

*** Sent via Developersdex http://www.developersdex.com ***



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
Excel 2007 Macro/VB Question DDE Question MadDog22 Excel Worksheet Functions 1 March 10th 10 01:47 AM
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good davegb Excel Programming 1 May 6th 05 06:35 PM
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good you [email protected] Excel Programming 0 April 27th 05 07:46 PM
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good you [email protected] Excel Programming 23 April 23rd 05 09:26 PM
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good you [email protected] Excel Programming 0 April 22nd 05 03:30 PM


All times are GMT +1. The time now is 06:57 AM.

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"