Question

A

A-Design

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
 
A

Aram Sarsyan

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Question 1

Top