# Comparing several rows of data for 1 record

1. ## Comparing several rows of data for 1 record

I have several rows of data pertaining to one record, how do I do a calculation that will select a single record (containing several rows) and then compare the data in a given cell in each of the rows pertaining to that one record and tell me whether the value has increased or not, The rows each have a number i.e. 1,2,3 or 4

2. Hi

Can you either provide an example workbook, or give more detail on your data, structure and process that has to occur.

rylo

3. ## More detail

I have hundreds of rows of patient data and within that data I need to look
at each individual patients data.
For every patient I have several rows of data, each row contains the same
fields but they relate to different events in their hospital stay which are
numbered 1,2,3,etc. I am trying to compare the latest event with the previous event (e.g. event 3 with event 2) and show whether their test results (which is a number) increase or decrease and if for instance it increases and is now over 30, count it as a yes and if it goes down count it as a no.
The macro will need to identify the most recent event and then compare this to the previous event, this will be different for each patient record. Can you help?

4. Hi

Definitely time for an example workbook. Doesn't have to be large, just as long as it captures your data structure and includes examples of all your possibilities, and gives the expected outcomes, and how this outcome would be determined.

Make sure there is no sensitive data in your example.

rylo

5. ## Comparing rows of data

Hi
Apologies I got caught up with other things!
Here is a small example of the database (sensitive data replaced) along with a section of the results page where I want the data to appear.
You can see that the first three rows of data all belong to Patient A, but with different sequence numbers (column K). I want to be able to report on BMI (Column P) if the number has reduced from one sequence to the next. The data has already been sorted by the user for a specific date range that they want to report on.
So if there are two sequence numbers (i.e. two rows of data for a particular patient) within a date range they select I need to be able to compare each of these and if the BMI has been reduced then count it. If there are more than two rows of data then I need to compare the two most recent sequence numbers and put the resulting count on the results page \$b\$8
Hope this now makes more sense.

6. Hi

1) There are only 2 rows of data for patient A
2) There doesn't appear to be a results page
3) There is nothing in B8.

rylo

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1