Excel variables help (Searching for specific numbers)

jamiegreen

New Member
Joined
Sep 3, 2007
Messages
9
I am trying to create an Excel database where I input a number and it finds the information that I am looking for.

For example, I have a list of 20 different companies that each have various supply numbers for properties ranging over a period of around 400,000 numbers spread out over between them. I want to be able to input a specific supply number on the database and it provides me with the relevant area, contact number for the company, and address etc.

So if the number that I input falls between 3000 and 4000, the details for one company appear. However if I input another number between 4000 and 5000 then a different company name appears, and so on.......

I am struggling with the formula, is this possible?
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Jamie,
Not sure how VB savvy you are.......
Very welcome, if you dont understand how to add more conditions to the code (As looking back my explanation was awful) post back with all the conditions you need like this:

Condition 1 is
Condition 2 is

To add the code right click the sheet tab name and choose view code.
Paste the code in there.

I chose C1 where the company name would appear change this to what you like in the code.

If you have more conditions...
Copy this line:

If Range("A2").Value >= 100000 And Range("a2").Value <= 699999 Then Range("C1").Value = "COMPANY 1"

as you can see you can then change the values greater than or equal to to any you like.

PS i also stated if the cell A2 is empty no company appears as i assume this is what you want.

If this is no good post back an ill try help or i am sure someone else will.
 
Upvote 0

Forum statistics

Threads
1,213,551
Messages
6,114,272
Members
448,558
Latest member
aivin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top