LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Code/Function to Look at Previous Entry to Validate Data

You're welcome. Thanks for the feedback!

--
Biff
Microsoft Excel MVP


"Steve" wrote in message
...
Thanks for the solution, it worked perfect!

"T. Valko" wrote:

Try this...

Assume A1:D1 are your column headers
Select the range C2:Cn

Where n = a number of rows that is sufficient to allow for future data
entry. C2:C100? C2:C500?

Goto Data tabData Tools groupData ValidationAllowCustom

Formula:

=AND(COUNT(C2),C2=MAX(IF(B$2:B2=B2,D$2:D2)))

You can enter a custom error message by clicking the Error Alert tab and
filling in the info.

When you're done OK out

--
Biff
Microsoft Excel MVP


"Steve" wrote in message
...
I've been looking all over the web for an answer or example of a code
that
I
can use in a vehicle mileage log.

I have 4 columns:

1. Date
2. Vehicle
3. Start Mileage
4. Ending Mileage

In the vehicle column, I have 3 vehicles (Vehicle 1, Vehicle 2, and
Vehicle
3).
When entering an entry into the log, I enter the date, the Vehicle #,
then
the start mile (at this point I would like Excel to look back through
the
Vehicle column and find the last entry for the particular vehicle # I
just
entered and then look at the ending mileage to ensure that the starting
mileage for the new entry is equal to or greater than the ending
mileage
for
that vehicle number.

Example

ROW DATE VEHICLE START MILEAGE END MILEAGE
1 1/1/2009 Vehicle # 1 10,005 10, 250
2 1/2/2009 Vehicle # 2 100,000 100,025
3 1/2/2009 Vehicle # 3 50,000 50,317
4 1/3/2009 Vehicle #2

Using the example above, when entering row 4, I would like to look back
through the previous entries in the Vehicle Column until finds the last
entry
for a particular vehicle (in this case Vehicle #2) then limit my enter
into
the Start Mileage Column to a value equal to or greater than the
previous
ending mileage (in this case, my value must be equal to or greater than
100,025). If I enter starting mileage that is less than the previous
ending
mileage for that vehicle, I would like to recieve an error message

I'm using Excel 2007.

Your assistance is greatly appreciated.






 
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
Validate Entry Custome Formula and Data Names EVO Excel Worksheet Functions 10 September 8th 09 03:03 AM
How to validate email address during data entry in Excel Ramiro Excel Discussion (Misc queries) 1 January 20th 09 08:30 PM
Automatically copy previous cells in data entry in Excel Sam Excel Discussion (Misc queries) 1 August 20th 08 10:01 PM
Validate in WS to prevent dual data entry Jonah Excel Worksheet Functions 1 March 10th 06 05:22 AM
Validate MsgBox Entry to Data in Cells David Excel Discussion (Misc queries) 13 December 21st 05 10:31 PM


All times are GMT +1. The time now is 08:52 PM.

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"