Help with Macro and cell copy

C

cokester

I am a newbie with VBA and Macros and request assistance with a
spreadsheet I am tasked with to complete.

Monthly, I export about 8000 records of lab data from our database and
use it for QA spreadsheets. We now have a new value that management
wwould like to be tracked.

I have created a macro based on one I found on the the internet (sorry
I can't rember the author)to extract the CALCM and PHOS data to a new
sheet. That seems to be working fine for the most part.

What I need to do now is multiply the CALM and PHOS results to come up
with CXP result per patient, if the patient have both a CALCM and PHOS
result for that Lab Date. Notice that a patient could have more than 1
set of results per month. see data below.

Is there a way to make a macro to move PHOS results to Col I so I can
multiply CALM and PHOS or is there a better way to accomplish this?

Also to note, These macros will be performed by normal users so it
should be as user friendly as possible.

<data>
A B C D E F G H
Chart# LName FName LabDate Lab result
111111 Lastname1 EMMETT 4/11/2005 CALCM 9.7 AD HEMO
111111 Lastname1 EMMETT 4/11/2005 PHOS 7.4 AD HEMO
111111 Lastname1 EMMETT 4/25/2005 CALCM 9.3 AD HEMO
111111 Lastname1 EMMETT 4/25/2005 PHOS 9.6 AD HEMO
222222 Lastname2 MARTHA 4/11/2005 CALCM 8.7 AD HEMO
222222 Lastname2 MARTHA 4/11/2005 PHOS 2.8 AD HEMO
333333 Lastname3 BETTY 4/11/2005 CALCM 8.2 AD HEMO
333333 Lastname3 BETTY 4/11/2005 PHOS 7.1 AD HEMO
</data>

Any Help or insight with will be appreciated.
Thank you.
 
D

Dave Peterson

Maybe you could just use a formula.

With headers in row 1 and data starting in row 2:

=IF(AND(E2="calcm",E3="phos",A2=A3,B2=B3,C2=C3,D2=D3),F2*F3,"")

And drag down.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top