KYC Posted December 29, 2003 Posted December 29, 2003 Problem: Need a formula to find previous lowest odometer reading for a list of records of randomly entered odometer readings so I can calculate MPG. Example. Previous record readings were 41789,43582, 47135, 46902. New reading is 44234. I need the calculation to find 43582, the previous lowest reading. Each reading is a new record.
CobaltSky Posted December 29, 2003 Posted December 29, 2003 Hi KYC, What you are describing can be done with either a self-join relationship based on range calcs, or by parsing the field index. Here's an example of the index parsing method that you might like to try. First create a time field called 'ModTime' and define it to auto-enter the record modification time. Then create a value list called 'Readings' and define it to draw its values from the 'OdometerReading' field. Last of all, create an unstored calculation field with a formula along the lines of: Case(ModTime, RightWords( Middle(Substitute(ValueListItems(Status(CurrentFileName), "Readings"), ",", ""), 1, Position(Substitute(ValueListItems(Status(CurrentFileName), "Readings"), ",", ""), Substitute(OdometerReading, ",", ""), 1, 1) - 1) , 1) ) The calculation result will not appear correctly until you exit the record (because it is reliant on the field index which is not updated until the record is committed) but it will then give you the next lowest OdometerReading value you are looking for.
KYC Posted December 31, 2003 Author Posted December 31, 2003 Thanks for the formula, you're a life saver.
Recommended Posts
This topic is 7977 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now