dsubash
New Member
- Joined
- Nov 22, 2024
- Messages
- 30
- Office Version
- 2019
- Prefer Not To Say
- Platform
- Windows
Hi Experts,
Need some VBA Code for my reports. Given below the screenshot of my database and reports page. I have used normal excel formulas to derive at this report. But it takes too much time to generate and sometimes excel hangs up.
Sheet1 (Data)
Sheet2(Report)
Help with a VBA Code to generate report would be of great help to me. My database runs to numerous rows and excel formula takes too much time to process the data.
Thanks in advance
Subash D
Need some VBA Code for my reports. Given below the screenshot of my database and reports page. I have used normal excel formulas to derive at this report. But it takes too much time to generate and sometimes excel hangs up.
Sheet1 (Data)
Sample Test Details TDM.xlsx | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | |||
1 | No. | Sample No. | Sample ID | Test | Result | Register Date | Name | Age | Gender | Case No. | Bed No. | Doctor | Department | Diagnosis | Remark | Checker | Test Date | ||
2 | 1 | 106233900 | 0106233900 | UREA | 29 | 01/01/2025 08:57 | NithishKumar | 0Years | Male | 01/01/2025 09:13 | |||||||||
3 | 2 | 106233900 | 0106233900 | SGOT | 19.6 | 01/01/2025 08:57 | NithishKumar | 0Years | Male | 01/01/2025 09:16 | |||||||||
4 | 3 | 106233900 | 0106233900 | GGT | 24.6 | 01/01/2025 08:57 | NithishKumar | 0Years | Male | 01/01/2025 09:17 | |||||||||
5 | 4 | 106233900 | 0106233900 | TP | 5.15 | 01/01/2025 08:57 | NithishKumar | 0Years | Male | 01/01/2025 09:17 | |||||||||
6 | 5 | 106233900 | 0106233900 | CHOL | 169 | 01/01/2025 08:57 | NithishKumar | 0Years | Male | 01/01/2025 09:15 | |||||||||
7 | 6 | 106233900 | 0106233900 | BILL-D | 0.32 | 01/01/2025 08:57 | NithishKumar | 0Years | Male | 01/01/2025 09:16 | |||||||||
8 | 7 | 106233900 | 0106233900 | ALP | 70 | 01/01/2025 08:57 | NithishKumar | 0Years | Male | 01/01/2025 09:16 | |||||||||
9 | 8 | 106233900 | 0106233900 | BILL-T | 1 | 01/01/2025 08:57 | NithishKumar | 0Years | Male | 01/01/2025 09:15 | |||||||||
10 | 9 | 106233900 | 0106233900 | CAL A | 11.3 | 01/01/2025 08:57 | NithishKumar | 0Years | Male | 01/01/2025 09:14 | |||||||||
11 | 10 | 106233900 | 0106233900 | TGL | 137 | 01/01/2025 08:57 | NithishKumar | 0Years | Male | 01/01/2025 09:15 | |||||||||
12 | 11 | 106233900 | 0106233900 | SGPT | 25 | 01/01/2025 08:57 | NithishKumar | 0Years | Male | 01/01/2025 09:16 | |||||||||
13 | 12 | 106233900 | 0106233900 | CREATIN | 1.03 | 01/01/2025 08:57 | NithishKumar | 0Years | Male | 01/01/2025 09:18 | |||||||||
14 | 13 | 106233900 | 0106233900 | ALB | 4.03 | 01/01/2025 08:57 | NithishKumar | 0Years | Male | 01/01/2025 09:17 | |||||||||
15 | 14 | 106233900 | 0106233900 | UA | 5.18 | 01/01/2025 08:57 | NithishKumar | 0Years | Male | 01/01/2025 09:14 | |||||||||
16 | 15 | 106233900 | 0106233900 | GLUC | 112 | 01/01/2025 08:57 | NithishKumar | 0Years | Male | 01/01/2025 09:14 | |||||||||
17 | 16 | 106234100 | 0106234100 | PHOS | 4.12 | 01/01/2025 08:57 | Maharaja | 0Years | Male | 01/01/2025 09:21 | |||||||||
18 | 17 | 106234100 | 0106234100 | UA | 6.3 | 01/01/2025 08:57 | Maharaja | 0Years | Male | 01/01/2025 09:20 | |||||||||
19 | 18 | 106234100 | 0106234100 | TGL | 151 | 01/01/2025 08:57 | Maharaja | 0Years | Male | 01/01/2025 09:21 | |||||||||
20 | 19 | 106234100 | 0106234100 | UREA | 54 | 01/01/2025 08:57 | Maharaja | 0Years | Male | 01/01/2025 09:19 | |||||||||
21 | 20 | 106234100 | 0106234100 | CHOL | 191 | 01/01/2025 08:57 | Maharaja | 0Years | Male | 01/01/2025 09:20 | |||||||||
22 | 21 | 106234100 | 0106234100 | GLUC | 116 | 01/01/2025 08:57 | Maharaja | 0Years | Male | 01/01/2025 09:19 | |||||||||
23 | 22 | 106234100 | 0106234100 | CAL A | 10.4 | 01/01/2025 08:57 | Maharaja | 0Years | Male | 01/01/2025 09:20 | |||||||||
24 | 23 | 106234100 | 0106234100 | CREATIN | 2.25 | 01/01/2025 08:57 | Maharaja | 0Years | Male | 01/01/2025 09:21 | |||||||||
25 | 24 | 106234000 | 0106234000 | CREATIN | 0.86 | 01/01/2025 08:58 | VetrivelS | 0Years | Male | 01/01/2025 09:19 | |||||||||
26 | 25 | 106234000 | 0106234000 | CHOL | 120 | 01/01/2025 08:58 | VetrivelS | 0Years | Male | 01/01/2025 09:18 | |||||||||
27 | 26 | 106234000 | 0106234000 | TGL | 192 | 01/01/2025 08:58 | VetrivelS | 0Years | Male | 01/01/2025 09:19 | |||||||||
28 | 27 | 106234000 | 0106234000 | GLUC | 402 | 01/01/2025 08:58 | VetrivelS | 0Years | Male | 01/01/2025 09:18 | |||||||||
29 | 28 | 106234200 | 0106234200 | GLUC | 97 | 01/01/2025 09:59 | AnandKumarV | 0Years | Male | 01/01/2025 10:13 | |||||||||
30 | 29 | 500573600 | 0500573600 | GLUC | 150 | 01/01/2025 10:19 | John | 0Years | Male | 01/01/2025 10:34 | |||||||||
31 | 30 | 500573500 | 0500573500 | GLUC | 94 | 01/01/2025 10:19 | Pooranima | 0Years | Female | 01/01/2025 10:33 | |||||||||
32 | 31 | 500573501 | 0106234400 | GLUC | 101 | 01/01/2025 10:29 | logapriya | Male | 01/01/2025 10:49 | ||||||||||
33 | 32 | 500573502 | 0106234400 | UA | 3.6 | 01/01/2025 10:36 | logapiya | Male | 01/01/2025 10:50 | ||||||||||
34 | 33 | 500573502 | 0106234400 | SGPT | 23 | 01/01/2025 10:36 | logapiya | Male | 01/01/2025 10:52 | ||||||||||
35 | 34 | 500573502 | 0106234400 | ALB | 3.97 | 01/01/2025 10:36 | logapiya | Male | 01/01/2025 10:53 | ||||||||||
36 | 35 | 500573502 | 0106234400 | BILL-T | 0.28 | 01/01/2025 10:36 | logapiya | Male | 01/01/2025 10:51 | ||||||||||
37 | 36 | 500573502 | 0106234400 | TP | 5.29 | 01/01/2025 10:36 | logapiya | Male | 01/01/2025 10:53 | ||||||||||
38 | 37 | 500573502 | 0106234400 | TGL | 231 | 01/01/2025 10:36 | logapiya | Male | 01/01/2025 10:51 | ||||||||||
Data |
Sheet2(Report)
Cell Formulas | ||
---|---|---|
Range | Formula | |
A2:A14 | A2 | =IF(LEN(B2)>0,SUM(A1)+1,"") |
B2:B3 | B2 | =IFERROR(INDEX(Data!$C$2:$C$10000, MATCH(0, COUNTIF($B$1:B1, Data!$C$2:$C$10000), 0)), "") |
C2:C14 | C2 | =IFERROR(VLOOKUP(B2, Data!$C:$Q, 4, 0),"") |
D2:D14 | D2 | =IFERROR(VLOOKUP(B2,Data!$C$2:$Q$10000,5,0),"") |
E2:E14 | E2 | =IFERROR(VLOOKUP(B2,Data!$C$2:$Q$10000,7,0),"") |
F2:F14 | F2 | =IFERROR(VLOOKUP(B2, Data!$C$2:$Q$10000, 15, 0), "") |
G2:G14 | G2 | =IF(COUNTIFS(Data!$C:$C, $B2, Data!$D:$D, G$1) > 0, G$1, "") |
H2:AE14 | H2 | =IF(COUNTIFS(Data!$C$2:$C$10000, $B2, Data!$D$2:$D$10000, H$1) > 0, H$1, "") |
B4:B14 | B4 | =IFERROR(INDEX(Data!C4:C962, MATCH(0, COUNTIF($B$1:B3, Data!C4:C962), 0)), "") |
Press CTRL+SHIFT+ENTER to enter array formulas. |
Named Ranges | ||
---|---|---|
Name | Refers To | Cells |
_FilterDatabase | =Report!$A$1:$AE$1128 | A2 |
Help with a VBA Code to generate report would be of great help to me. My database runs to numerous rows and excel formula takes too much time to process the data.
Thanks in advance
Subash D