ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with Macro and cell copy (https://www.excelbanter.com/excel-programming/329452-help-macro-cell-copy.html)

[email protected]

Help with Macro and cell copy
 
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.


Dave Peterson[_5_]

Help with Macro and cell copy
 
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.

wrote:

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.


--

Dave Peterson

[email protected]

Help with Macro and cell copy
 
Works like a champ...Thank You



All times are GMT +1. The time now is 06:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com