Finding largest number within a Range

mrmarc

Board Regular
Joined
Feb 3, 2014
Messages
79
I need to populate the dropdown in a combo box with the largest number in a field that's between 1 and 5000. There are number above 5000 in the field, but I want the largest number between 1 and 5000. Should I use a query? Or VBA?
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Why do you need a dropdown/combo when you only have 1 value? Why not a text box?
Might be easier if you told us what you need this value for. That is will you be using that value in a query??
 
Upvote 0
Why do you need a dropdown/combo when you only have 1 value? Why not a text box?
Might be easier if you told us what you need this value for. That is will you be using that value in a query??

Hi Jackd,

Yeah, a text box would probably work just as well. Here's the scenario:

Bob inputs "pallet numbers" when finished product is received. His numbers start at 5000.

Joe inputs "pallet numbers" when product is produced within the plant. His numbers start at 1.

If I do a Dmax to find out the "next" number to input it always goes for (obviously) the highest number, (so a number in the 5000s). This is good for Bob but not good for Joe.

How do I populate a text box for Joe so that he know what pallet number to input next. So if he just inputted 500, and wants to add a new record, I want the text box to be populated with 501.

Note: The Pallet number field can contain multiple entries of the same pallet number.

The key is to keep all information on one table.

I hope this helps. Let me know. Thanks!
 
Upvote 0
If I do a Dmax to find out the "next" number to input it always goes for (obviously) the highest number, (so a number in the 5000s). This is good for Bob but not good for Joe.
Look more closely at the DMAX function. The third argument is for criteria. So you can use the username in there, so you will get the Max value for each specific User.
 
Upvote 0
I'm not sure about setting up "users".

So how could the Dmax function look?

DMax("PalletNumber", "PalletRecords", PalletNumber < 5000)

or...
 
Upvote 0
Bob inputs "pallet numbers" when finished product is received. His numbers start at 5000.

Joe inputs "pallet numbers" when product is produced within the plant. His numbers start at 1.
DMax("PalletNumber", "PalletRecords", PalletNumber < 5000)
If I understand your correctly, it sounds like you can forget about using "PalletNumber" in the Criteria argument, and use "User" name instead.
 
Upvote 0
I agree with Joe4 - it seems the use of pallet number is totally misleading. It appears that pallet number is being used for 2 separate purposes.

It isn't clear what pallet numbers mean in your business. Seems the meaning of pallet number depends on the user Bob or Joe????
 
Upvote 0

Forum statistics

Threads
1,221,710
Messages
6,161,445
Members
451,706
Latest member
SMB1982

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