![]() |
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 |
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 *** |
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 *** |
All times are GMT +1. The time now is 02:56 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com