Você está na página 1de 5

Cc tham chiu (cell) v vng (range)

(p dng Excel 2003/ 2007) Mt tham chiu xc nh mt hay vng trn bng tnh gip Excel bit c v tr cha d liu m bn mun s dng trong cng thc. S dng tham chiu trong cng thc gip mt cng thc c th truy cp c n d liu cha ti nhiu ni khc nhau ca bng tnh hay ngc li mt gi tr trong mt c th c s dng bi nhiu cng thc khc nhau. Ngoi ra, Excel cho php tham chiu n cc thuc cc sheet khc trong cng workbook hoc khc workbook. Cc tham chiu n cc trong workbook khc c gi l cc lin kt (link). Kiu tham chiu A1 Excel mc nh s dng kiu tham chiu A1, ngha l cc ct c t tn theo cc mu ch ci (A n Z v cc t hp ch ci). Excel 2003 cc ct c t tn t A n IV (256 ct) v cc dng c nh s t 1 n 65536, Excel 2007 th t A n XFD (16384 ct) v cch dng c nh s t 1 n 1048576. Cc k t v cc con s ny gi l cc tiu ct v dng (row and column headings). tham chiu n mt , ta ch cn nhp vo k t i din cho ct tip theo sau l s th t ca dng, v d tham kho n C2 th ny c k t ct l C v s dng l 2. Tham chiu n ti ct A thuc dng 10 Vng a ch trong ct A t dng 10 n dng 20 Vng a ch thuc dng 15 t ct B n ct E Ton b cc thuc dng 5 Ton b cc t dng 5 n dng 10 Ton b cc thuc ct H Ton b cc t ct H n ct J Vng a ch t ct A n E v t dng 10 n 20 a ch A10 A10:A20 B15:E15 5:5 5:10 H:H H:J A10:E20

Tham kho n worksheet khc: Xt v d sau, hm AVERAGE tnh ton bnh qun cc gi tr thuc vng B1:B10 trn Worksheet Marketing trong cng Workbook.

Ghi ch: Tn worksheet v du chm than (!) c t trc vng a ch tham chiu. V d: Tham chiu n a ch Tn_sheet!a_ch_. V d: =A2*Sheet2!A2 =A2*Thong so!B4 Khi tn sheet c cha khong trng th trong cp nhy n Tham chiu n a ch trong workbook khc th c dng [Tn_Workbook]Tn_sheet!a_ch_. V d: 1 worksheet khc nhng cng workbook th c dng

Trn Thanh Phong

=A2*[Bai2.xlsx]Sheet3!A4 =A2*[Bai tap 2.xlsx]Sheet3!A4 Khi tn Sheet hay Workbook c cha khon trng trong cp nhy n =A2*C:\Tai lieu\[Bai tap 2.xlsx]Sheet3!A4 Khi tham chiu n workbook khc m workbook ny khng m =A2*\\DataServer\Excel\[Bai tap 2.xlsx]Sheet3!A4 Khi tham chiu n ti nguyn chia s trn my ch trong mng Tham chiu vng Trong mt s trng hp nhp cng thc th bn nhn c hp thoi thng bo tham chiu vng (Circular Reference) v trong cng thc c s dng gi tr trong m bn ang nhp cng thc. V d: Ti A3 bn nhp vo cng thc =A1+A2+A3

Cnh bo tham chiu vng Nu cc php tnh ca bn yu cu phi tham chiu vng th bn cn phi bt tnh nng ny ln. Nhn vo nt Office Excel Options Formulas Calculation options chn Enable iterative calculation.

Ty chn tham chiu vng (Excel 2007) Maximun Iterations: S ln tnh vng ti a Maximun Change: S thay i ti a ca gi tr

V d: A1 cha s 2, A2 cha s 3, A3 nhp vo cng thc =A1+A2+A3 v vi thit lp tnh vng nh trn th kt qu A3 ln u tin sau khi nhp cng thc l 15. S khc nhau gia tham chiu tng i v tham chiu tuyt i

Trn Thanh Phong

Tham chiu tng i (Relative references) Tham chiu tng i trong cng thc (v d nh A1) da vo v tr tng i ca a ch cha cng thc v a ch ca tham chiu n. Khi v tr ca cha cng thc thay i th a ch tham chiu n cng thay i tng ng. Khi ta chp cng thc sang cc dng hay ct khc, th a ch tham chiu cng t ng thay i tng ng. Excel mc nh cng thc nhp vo dng tham chiu tng i. V d, khi ta chp cng thc ti B2 cha tham chiu tng i n A1 (=A1) xung B3 th khi cng thc trong B3 t ng thay i tham chiu n A2 (=A2).

Tham chiu tuyt i (Absolute references) Mt c cng thc tham chiu tuyt i n mt no (v d $A$1) khi d cho cha cng thc b di chuyn hay sao chp n ni khc th cng thc vn lun lun tham chiu n (A1). Excel mc nh cng thc nhp vo dng tham chiu tng i, do vy ta cn chuyn sang tham chiu tuyt i khi cn thit (bng cch t du $ trc cc tiu dng v ct phm tt l F4). V d, nu ta chp mt cng thc (ti B2 xun B3) c tham chiu tuyt i n =$A$1 th cng thc trong B3 vn l =$A$1.

Tham chiu hn hp (Mixed references) Tham chiu hn hp l dng tham chiu kt hp 2 loi tham chiu tng i v tuyt i, trong tham chiu hn hp ch c ct hoc dng c c nh (tuyt i). V d, tham chiu c nh ct c dng $A1, $B1, ... v tham chiu c nh dng c dng A$1, B$1, . Khi v tr ca cha cng thc thay i th phn a ch tng i (trong tham chiu hn hp) s thay i theo cn phn a ch tuyt i (trong tham chiu hn hp) s khng thay i. V d khi ta chp cng thc c cha tham chiu hn hp (=A$1) trong A2 sang B3 th cng thc trong B3 thay i thnh =B$1.

Kiu tham chiu 3-D Khi chng ta mun phn tch d liu c vng a ch ging nhau nhiu worksheet trong cng workbook th khi cn n kiu tham chiu 3-D. Tham chiu 3-D c dng nh v d sau =SUM(Sheet2:Sheet13!B5), ngha l tnh tng cc B5 nm nhiu sheet (t Sheet2 n Sheet13). Tham chiu 3-D c th dng tham chiu n cc nm trn cc sheet khc, (c th t tn cho tham chiu 3-D), sau c th dng cc hm sau tnh ton: SUM, AVERAGE, AVERAGEA, COUNT, COUNTA, MAX, MAXA, MIN, MINA, PRODUCT, STDEV, STDEVA, STDEVP, STDEVPA, VAR, VARA, VARP, v VARPA. Tham chiu 3-D khng th dng trong cng thc mng (cng thc kt thc bng lnh Ctrl+Shift+Enter). Tham chiu 3-D khng th dng cc ton t s hc (+,-,*,/,^, &) , ton t so snh (= > < >= <= <>, ton t logic (and, or, not ). 3

Trn Thanh Phong

Tham chiu 3-D s thay i nh th no khi thc hin cc lnh move, copy, insert, hay delete Cc v d sau minh ho s thay i ca tham chiu 3-D khi bn thc hin cc lnh move, copy, insert, hay delete trong worksheet. V d ta c cng thc =SUM(Sheet2:Sheet6!A2:A5) tnh tng cc A2:A5 t worksheet 2 n worksheet 6. Insert hay copy Khi chn hay sao chp cc sheet thuc Sheet2 (sheet u - endpoint) n Sheet6 (sheet cui endpoint), Excel s bao gm lun tt c gi tr ca cc A2:A5 trn sheet mi thm vo kt qu tnh ton. Delete Khi xo cc sheet thuc Sheet2 n Sheet6, Excel s xo cc gi tr thuc sheet b xo khi kt qu tnh ton. Move Khi di chuyn cc sheet thuc Sheet2 n Sheet6 n mt v tr nm ngoi vng tham chiu sheet, Excel s loi b cc gi tr nm trn sheet di chuyn khi kt qu tnh ton. Move an endpoint Khi di chuyn Sheet2 hoc Sheet6 n v tr khc trong cng workbook, Excel s t hiu chnh kt qu tnh theo cho ph hp vi vng tham chiu sheet mi (m rng vng tham chiu sheet). Delete an endpoint Khi xo Sheet2 hoc Sheet6, Excel s t hiu chnh kt qu tnh theo cho ph hp vi vng tham chiu sheet mi (thu hp vng tham chiu sheet). Kiu tham chiu R1C1 Ngoi ra chng ta cn c th chuyn kiu tham chiu t dng A1 sang dng R1C1, kiu tham chiu R1C1 rt hu ch cho vic tnh ton v tr dng v ct trong VBA. i vi kiu R1C1, Excel k hiu R ch dng theo sau l s th t dng v k hiu "C" ch ct theo sau l s th t ct. Tham chiu R[-2]C R[2]C[2] R2C2 R[-1] R ngha Tham chiu tng i n nm trn hin hnh 2 dng trong cng ct Tham chiu tng i n nm di hin hnh 2 dng v nm bn phi 2 ct Tham chiu tuyt i n ti dng 2 ct 2 (tng ng B2) Tham chiu tng i n c dng nm trn hin hnh Tham chiu tuyt i n dng hin hnh

Lu : Mc nh, khi ghi macro Excel s sinh ra cc tham chiu di dng R1C1. Bt tt kiu tham chiu R1C1 Excel 2003 v trc: Options | Tools | General | Settings | R1C1 reference style.

Trn Thanh Phong

Excel 2007: Excel Options | Formulas | Working with formulas | R1C1 reference style

Trn Thanh Phong