Documente Academic
Documente Profesional
Documente Cultură
xcel,
it's Magic!
NOTE: All the tips in this book will work in Excel 2000,2002.2003, and
2007. Most will also work with Excei 1 997.AII the screen shots are from
Excel 2007, and the detailed descriptions of how to access many of them are
via Excel 2007's new Ribbon. There are also descriptions for accessing the
same tips using versions earlier than Excel 2007, and these all begin with the
italicized text,"[Exce1 2003: . . . ]"
Tips 27, 28, 68, 69, and 90 have no equivalent in versions other than Excel
2007.
Bob Umlas
SECOND EDITION
.4'
.. .,,
IIL PUBLISHING
ing, Inc., 110 East 59'h Street, 31" Fl., New York, NY 10022
www.iil.com
ISBN 978-0-9792153-2-2
I'd like to thank my wife, Judy, for her continued support while I pursue my
Excel "studies," including trips to Redmond for the MVP Summits, as well as
spending time answering people s questions on the newsgroups .
I also want to thank Will Tom pkins my fellow Excel MVPs, my co-work
ers, and the many other contributors to the online newsgroups-David
Hager, John Walkenbach (who has put many of my excel "oddities" discover
ies on his website), Bill Manville,Jim Rech,Jan Karel Pieterse,Tom Chester,
Reed Jacobson, Eric Wells, Bob Greenblatt,Tim Aurthur, Monika Weber, Bill
Jelen {"Mr. Excel"), Jim Janssen, and Joe Sorrenti for their contributions to my
knowledge.
I want to acknowledge my best friend. Jerry Goldin, Ph.D., for his ongoing
support of everything I do and of my entire family. I want to thank my sister,
Marilyn Umlas Wachtel, for being there when I have most needed her.
My wonderful children, Stefanie and Jared Um las, have put up with me as
I remained at the computer, writing this book, instead of watching Alias or
The Simpsons with them. They have been terrific!
I would especially like to thank E. LaVerne Johnson, President and CEO
of International Institute for Learning (IlL), for believing that I am one of the
top three Excel gurus in the world, no matter what I tell her. I also thank
her for supporting my love of teaching by offering the Mastering Microsoft
Excel course through IlL all these years.
'
Bob
Umlas, Microsoft
Excel
MVP
ntemational Institute for Learning, Inc. (Ill), headquartered in New York City and
with eleven operating companies in major cities around the world, is a global
leader in Project, Program and Portfolio Management, Microsoft Project, Six Sigma,
and Business Analysis corporate solutions.
Using its Many Methods of Learning TM, Ill combines the theory and practice
Forthcoming:
Project Management Poetry, Puzzles and Prose
Positive Leadership in Project Management:
Practical Leadership for the Practitioner
by Frank P. Saladis, PMP
"I was astonished reading this book. The tips are excellent and well
worth knowing-you won't want to miss even one of them! Although Eng
lish is my second language, I got through it effortlessly. Bob Umlas is a magi
cian-thanks for sharing this immense knowledge with us!''
- Monika Weber, Excel MVP
Project Manager, Corporate IT
AMCOR Rentsch Ltd.
"I carry This isn't Excel, It's Magic! in my car and read tips while stopped at
traffic lights. The book is already full of post-it flags fo r all the tips I didn't
know. I think I've flagged all but the title page."
- Melanie Beck, technical training specialist,
Grant County Public Utility District
"I thought I knew a lot about Excel; but I now realize how little I did know.
There are so many great head spinning, jaw dropping tips and tricks. It makes
unlocking the power of Excel an amazing experience. A must have for (Excel)
users everywhere. Mr. Umlas (is) a true magician."
-Aiesa Lambert, corporate accountant, CM Foods
"I love this book and highly recommend it to all Excel users. Whether you
are looking for some simple techniques to make you more productive in
Excel, or if you are ready fo r some sophisticated how-to's, you will learn
valuable information from This isn't Excel, it's Magic!"
- Bob Schuster, partner of ExceiMagic and
RWS Information Systems
is) a simple, but amazingly useful book.Very clever!
Bob has produced a compact, but brilliantly useful book of shortcuts, for
mula secrets and tricks. One thing I loved about this book is it tackles 'real
world' problems.This is not a book for Excel beginners. However, if you use
Excel professionally o r for fun then you absolutely should consider grabbing
a copy of this highly useful and informative book. It will save you many hours
of work and delight you at the same time."
- Darryl Collins, Excei!VBA developer
"(This isn't Excel, it's Magic/
FEATURES
14
16
21
22
23
25
27
29
31
33
34
36
38
40
41
42
46
47
48
51
53
54
56
57
60
62
64
65
FORMATTING
66
70
72
73
74
75
76
FORMULAS
78
80
81
83
86
90
92
95
96
97
98
100
101
102
103
104
105
107
108
110
1 11
113
115
1 18
119
124
125
128
132
135
138
140
141
143
145
146
147
148
149
150
151
152
153
154
Magid
11
MISCELLANEOUS
155
157
161
163
165
166
167
169
171
172
173
PRINTING
175
178
179
180
183
VBA
12
184
185
186
188
189
193
194
195
196
197
200
201
203
204
206
208
209
13
"
l8J
---
Microsoft Excel
But by using the Advanced Filter on the Data tab: [Excel 2003:
Data iFilteriAdvanced Filter]
rrp
Home
rnaI
Insert
Page Layout
(llil Connections
Properties
Refresh
All
Formulas
lillJ 7
Filter
Sort
Connections
Data
Cl.:ar
Advanced
'{<> Reapply
2
3
4
5
6
7
8
9
10
11
12
13
14
1\dvance<! Filter
Action
b_ist range:
Criteria range:
Copy to:
I=Range2
ISheet l !$A$ll
OK
]I
Revit
tI
11
Cancel
!_]Jared
2 1Fred
3 Stefanie
Judy
4 Bob
5
6 Alice
7 Jared
Kate
Magid
15
Description
____
m35-c summary
input
--
m35-c gl coun-
m35-c amounts
m35-c gl description
m35-d description
10
11
12
13
--
14
15
16
17
i81
19
20
'
21
22
23
24
m35_.:<!_gl desption
_
m35-d amounts
<:...
::..:.
.:.:._:
.:..._
m80 ye balance
[
I
[
!_
I
I
I
I
I
m80 gl acount#
lm80 gl description
m81 ye balance
m 82 gcount#----_
m82 gl description
I
m82 ye balance
----:
m83 gl description
You can't do it with FS/(Goto) Special and use features there, but you can
use Excel 2007's Find All, with a twist...
16
If you use Home tab, Find and Select from the Editing section, then Find (or,
simply press Ctri/F): [Excel 2003:Edit!Find)
I:
..
[il
a
..
,
..
=I
= ee
..
-V
&
Find...
,Beplace..
Go To ...
Go To Special...
Form ulas
Comments
Conditional Formatting
Constants
Data Validation
Select Objects
Selection Pane...
type in "amounts" (without the quotes), then click the Find All button you'll
see:
,
'
Fin!! ] Rl!l<e l
Fi!)dwhat:
Iamounts!
Options
F[nd All
Book
S heet
hydradlentorganirermap2.xis
hydradiefltorganirermap2.xis
hydradiemorQanirermap2.xls
hydradlentorganizermap2.xis
hydradJentorganirermap2.xis
hydradientorganizermap2.xis
hydrdiemorQniu!rmp2.xls
hydradiemorganirermap2.xls
hydradiefltorganirermap2.xis
hydrdiemorQaniwmap2.xis
hydradientorganizermap2.xk
....
....
A:.-.,...
...........v
....--.
...
.....,
j'iicell(s) found
......
I I Eind Next I
$9$10
$8$14
$6$18
$6$22
$8$26
$8$30
$6$34
$6$38
$9$42
$9$46
$9$50
$9$51
.f.O.t-C'O
Close
m3S- d mounts
.,..'
17
Here's the twist: instead of selecting the items in the found list, you can
use ctri!A (or shift click the last item in order to select from the already
selected item through the item you're now selecting, or even ctrllclick to
select specific items), and all items selected in the list will also be selected
in the worksheet:
"
O..:.C.iptiel'l
mlS.cw....'Y
.
ft,ut
MlS..c:tl C.YM.
nOS.c ,, 6Kaf,tio-n
lft3:S-cIMOUntl
nOS-4111 c1Htf1p*
nOS-41 Uttt.nUI)' lnn
m3S
n1JS4
"" ,_,
----------------------------3,
IC'IOU..
gl
glltW
l ipion
m)S,4 UIIOV1'111
n.O sl Ue ll ntl
Jl dHUiplion
n1180 hJnot
m80 lm ountt ptld'""
ni81 tl e.unt.f
nt81 tl dtsO"fpllon
n180
nl81 ye b t
.s a.n
e.
n.S t emountfpeldel\er
nt82 gl eount *
n8
l 2 gl dowlptlo*'
nl82 yo h.tlinet
ru82 mounts paid tftet
m8lgleountk
m83 gl dewlrtlon
m83 ye b 6 1 anc
t
nl8) trnountt poht after
n.& gleount.f
_,, - ..............
Now, when you close the dialog box, the cells will still be selected!
Now, suppose your worksheet looks something like the following, and you
want to change all the yellow cells to be bold (and still yellow):
A
1 Form Name
FORMS471
3 FORM5471
4 FORMS471
s
FORMS471
6 FORMS471
7 FORMS471
FORM547l
9 FORMS471
10 FORMS471
11 FORMS471
12 FORM5471
13 FORMS471
14 FORMS471
15 FORM5471
16 FORMS471
17 FORM 5471
18 FORM5471
19 FORM5471
20 FORMS471
21 FORMS471
18
Selecting by text now won't do, but there's another feature of Excel's Find
command: Find by Format. Note the Format button at the top, (you may
need to click the Options button):
Fin!;!
Find what:
Witbin:
R.egjace
I:-I
;==
By Rows :::;;
ook in:
Set
I '[
f;.rm.a_t,.,
Formulas
im.rm!!!
fjiU,;:JI
Category:
G eneral
Number
Currency
II
-'
"
Accounting
FOnl
-:
Alignment
-:
0 1ati::h ase
0 Match entire cell contents
Sheet
Search:
I No Format
-----
I Border l !
Fill
IProtection
Sample
oate
Time
Percentge
Fractton
Scient(fic
Text
Special
Custom
Cell .
..
OK
'II I
Clear
Cancel
19
I n this dialog, you can enter all the properties of the formatting you're go
ing to want to find, but there's also an easier way: click the bottom button,
"Choose Format From Cell. . . " When you do this, you'll see a special cursor
which looks like the regular cell-selection cursor but with an eye-dropper
next to it!
When you click on the cell containing the format you want to find, you'll
then see a preview of the formatting in the dialog box, and you can combine
this with text to find as well!
Find and Replace
Find
J Re12.lace j
FiQd what<
Within:
Searcli:
:::l L:::f.:gioiC::.::J
P_r_e_v_ie_w_"' d
c
Ef b
---=
=---
jsheet
J.sy Rows
r rvlatch ase
3
2J
.
a
Options<:<
F[nd All
E.ind Next
Close
Form Name
2 FORM5471
l
FORM5471
FORM5471
FORM5471
FORM5471
FORM5471
Fil!!
Fid what:
FORM5471
IFORM5471
FORM5471
19 FORM5471
21 FORM5471
20
'-----'-"v.ll
I
:====='=:;
v _l
vi
17
18
FORM5471
16
Preview
j[
Format ..
0 tch ase
[Opljons I
Fr>d AU
I !1
e;nd Next
Close
------- ------Ex
cel
.--
Oplio n s
------,
I][J
Popular
Formulas
e _j
Customize
Trust Center
Resource s
IDown vj
Advanc
Add lns
Editino options
Proofing
'
Advanced
.,0
/.0
It]
r1
133554 :I
To cut and paste a range, select it and drag the border (the cursor will
change to a cursor with a 4-headed arrow).
To cut and insert paste a range, drag a range by its border and the shift key
held down.You will see an indication of where the range will be inserted:
1
2
3
L
1/1/2003
c
36
45
40
50 2/1/2003
44
48
52
56
55 3/1/2003
60
4/1/2003t
'
5/1/2003
6/1/2003
The grey line indicates where A1 :C2 will be cut and insert-pasted.The intel
lisense shows that the new location will be at AS:C6.
If you hold the ctrl key down with either of the two action s above, the cut
becomes a copy.
This isn't Excel, it's Magic!
21
1 . Hold shift key while dragging Fill Ha ndle.You will see a new shape to the
fill handle, a split vertical 2-headed arrow.
22
Department
Acctg
Acctg
Acctg
4 Acctg
6 Acctg
Acctg
8 Acctg
Acctg
'10 Acctg
..
,11 Acctg
-12 Acctg
:0:13> Acctg
-
14 Acctg
lS' Acctg
..
v..,
0_J.
. __
I _:e::...jl...
....J F .--...: _i_:
I c --L---=:.
__
,_
_
_
_niOI'
-2!!1,!!-,P.,
!51..
1ReQiace1
A c-t
gj
FiQdwhat: .-lFins[
11
---
.=
Previe:., ..
C::}} 0 ch
!sheet
MatcH tire_cell cQ.ntents
0
_
,
"-i
;,
====
S,earch: :=
Rows
W
_
r.;:
!,ook in: (Formulas
!;,ase
i :
Witb.n
F(nd All
]1
Next
16 Acctg
How can you tell where the last Acctg department is? Use Find & Select from
the Home Tab (or ctri/F), and before clicking Find Next, hold the shift key, and
you're there in one click!
23
Fing
ReQiace
Fi!ld what:
...
IAc_. c_tgj------------
271
272
F[nd All
Department
. . .1:-- 1""\-.-.
........... _ ._...
1-
--
J ( __Eind Nxt J
---- -
You can use a wildcard to search for anything backwards, so starting from
cell A1 , you can find the last row or column!
!!t
.!!!J.d Rep!!
..
,,.,
F"''! L ReQ!occ}
From cell AI. finding an backwards and
,-
iQ<:I
F v.t.at:
wt!!On:
rch:
ooi<irl;
24
Shett
_J
used column!
Ffld AI
I I fi>d -
Closej
:b
3 c
J'
__ _
'
'
Cut
Lt!l f:;opy
1_ __2l
7 g
faste
Paste pecial...
Delete...
Clear Contents
. ,..
....;.
.- .;...
1 ....
a
:b2
3
4
L..
c
---<
7 g
8
9
10
11
12
13
14
15
16
17
18
1,!d
___
5 e
6
:'
'
:t
--:
'
'
'
....... ..................
------
Paste Special
Paste
0!!1
OE.-.Jas
0:talues
0Fetmats
0 !:_omments
0 ValldatiOQ
I:RJ
Operation
0NQne
0P4d
0 S.Ubtract
0Muiply
0Divide
0 Transpos!l_
OK
][
Cancel
25
i 1'!j..
t_:!\;::..-..
. k...____(j .c
'
'
-
'
2 b
3 c
4 d
5 e
6 f
7 g
8 h
9_
1('\
26
--
__
---
--
--
'
'
'
t
,
'
--
__
'
--
.........J
__
_
will be presented with a dialog containing several options when you let go:
36
45
40
50 2/1/2003
1/1/2003
I Fill
4
5
6
7
s
9
10
n
12
13
- ---- -
tI
Cop Cells
.
. ..
eries
Fiii1Nith.Qut Formatting
Fill Days
Fill eekdays
Fill Months
I
I
Fill Years
.blnear rrend
!;iro.,.Jth Treno
Sries...
27
What the original selection contains will determine what options are
available in the dialog:
1
2
3
4
36
40
c
45 1/1/2003
so 2/1/2003
opy Cells
Fill eries
7
8
F111 0,; s
9
10
11
Fill W.:ekday:
F1ll Months
F111 Years
12
13
14
1inear Trend
Growth Trend
15
--
Sries...
Notice that in the first example, dates were selected, so the middle sec
tion of the dialog (filling dates) is available, but the second example has the
middle section disabled because dates weren't selected. The Fill Weekdays
option with dates selected can be quite useful:
36
40
45
50
I
1/6/2005
c
1/7/2005
1/10/2005
4
1/11/2005
1/12/2005
1/13/2005
1/14/ 2005
1/17/ 2005
1/18/2005
Cell C1 's fill handle was dragged down to cell C9 with the right mouse used,
and Fill Weekdays was chosen. Notice 1/8,1/9, 1/1S,and 1/16 are missing,
because they're weekends.
28
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Data:
Data:
,....-
Data:
12
14
Data:
33
Data:
Data:
Data:
21 Data:
25
Data:
Data:
Data:
50 Data:
Data:
88
27
89
63 Data:
70
Data:
30
105
Go To Special
Select
0 orrrnents
0cqnstants
OEonnulas
01'1\Lml>ers
1
o--
fig,
0Log_icals
0rrors
0 Blan!!,s
0 Current region
0Current ray
0 Ot!jects
0 Row differences
0 Colum differences
0 erecedents
0 Dependents
Cecl nl
'lle-ls
0 lait cell
0 Visible cells onl:,:
0 Condi{ional formats
0 Data yahdation
AU
Same
II OK J I
Cancel
J
This isn't Excel, it's Magic!
29
That is, we're selecting constants which are num bers (not text). Then we use
Define Name from the Formulas tab. [Excel 2003:/nsertiNameiDe(tne].
But you'll find that if the resulting name was too long. then Excel won't even
bring up the dialog! You can name these cells most easily, though, by using
VBA! Press Alt/F1 1 . getting you to the VBE (Visual Basic Environment), then
Ctri/G (the immediate pan e) then type this exactly, and press enter:
Selection.Name = "MyData"
Then Alt!Q will bring you back to Excel. Now the name MyData will accu
rately refer to the desired cells.
,
30
View
Add-Ins
q
[]
Zoom to
Zoom
100%
Zoom
New WindowI S
9 Arrange All
Selection Freeze Panes
.JJ
.d!
""""
--
L1 3!1
El
EQ
89
Save
Switch
Workspace Windows
Window
Al
BooloS:l
A
1 Cool!
f,. =Sheetl!Al
C_l
800'6:2
B_
-1.::.
E_.!_II'-+--=
A-.J-
L__:::._
C _!_
__;_
D _::
Cool!
1-=---p;:
::::.:.-.
1
0
ul
"
>t1
,-
=
""""::::-:" """'"--,;
0
Sheetl/
Sheet2""' She
etJ
:1
1
0
i Jl 1
'-=
"'-';;
;;;
..,.
; ,.e,
LJ
sn
e
e
u
=
s
h
!!
ee
2
Lj
=
stl
!!
!j
!J
!:=:
:=
31
View the
Al
fi< Cool!
@ Book6:1
A
I
1 cool!
I
2
99998
9.:
99
::
9:..: :
100000
v
Cool!
5
6
7
8
9
View
@ Book6:1
'
1 !cool!
2
-
...
I
I
(
.,
/x =Sheetl!Al
- 1::1 X Book6:2
t;E
A
D
c
1
1
lrr1 =Sheetl!Al
3
4
----1
5
6
.....
=
=
'--
3
4
5
6
____,
I 4 mSheet2/ ShelT
rH..,.J
... 9
1tdl
.-
I . ;3 Sheeq.Lsheet3
To rejoin the windows, close the window by the "x" in the upper right, not
by Office button/Close, [Excel 2003:FileiC/ose] because the separate windows
would save and reopen that way.You can use New Window many times and
get as many windows as you wish of the workbook.
Think of it as if you were looking out your physical window and seeing
parked cars. Now move to another window and look at the same cars. You
have a slightly different perspective of the same object.That's kind of what's
going on here.
32
Formulas
... Data
I t, b
Clip
Art
s.hapes smart
...
Review
0.1:rifi. ._!,!,
Ba
'
.s
Basic Sha.!:..pes=----
0 6 0Q O G Q 0 0
6C> O D IF CS OO I3 Bl
D @@ tru Q <V (;J \
( ) {} ( ) { }
Press the esc key to stop that feature or click the tool again!
33
w
------. -
65
30
84
85
87
14
69
78
97
42
71
88
32
71
62
57
47
65
50
63
92
Click in E1 and click the Sum tool (on the Editing section of the Home tab)
[Excel 2003:Sum too/bar button on Standard Too/bar]
[
Q.
Filter y Select
Editing
A
1
65
c
54
85
30
46
87
74
14
69
78
97
88
42
71
2
3
6
7
84
57
so
8
34
32
71
62
63
92
47
'
65
'
60
54
2
3
4
5
6
7
8
60
66
28
58
57
16
14
91
9
34
70
62
29
16
10
70
11
12
13
14
66
68
76
13
46
32
81
95
15
16
77
70
18
A single click of the sum tool will put the correct totals in!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
60
54
60
66
28
58
57
9
16
14
238
46
91
29
16
320
7
68
77
13
81
32
70
34
70
62
70
66
95
76
551
18
41
33
35
h
l l
20050923
20051107
20050930
Select the date(s), and use Data tab, Text-To-Columns, [Excel 2003:Data!Text
to Columns]
Data
V..
l Review
Clear
'"{v Reapply
.Advanced
Iter
View
Developer
Add-Ins
11 Data Validaion
Ef:c Consolidate
Text to Remove
. s"'
lysi
Ana
at-If
Wh
tes
lica
,
Dup
!!ms
,Sol
ffi-:.I
"'
Data Toots
.of 3.
0Jii'J
0[
iiiT,i1
0 Fixed \:)!idth
tl-0050923
0051107
ri
0050930
[
36
Cancel
II
< B<;d<.
ll
f!!ext >
J! [
finish
Even though the dates are fixed width, in this case you can simply click
"Next" twice.
In step 3 of wizard Select Date,YMD:
.Convert Text to Columns Wizard Step 3 of 3
Tt-is screen lets y(ltJ select each cobnn and set the Data Format.
data fOI'mat
Oal
Orext
Cobnn
1Advanced... 1
Ostnob01'1: MYO
DVM
Data erev'L.!YD-"'M"'-----1
tI
Cancel
I[
<
!l_ack
Next >
If you click Finish now, the result will replace the dates.You can select an
other destination cell:
3
0 l:ieneral
Orext
0Qate:
v
0 Oo not t cobm
20050923 9/23/2005'
2 20050930 9/30/2005
3 20051107 11/7/2005'
1
c;
..J (d .
""'
"
Hom
sll
-:J
tnstn
All
Formul.ls
Coontchons
clltlrnts
Connections
81
. \.
1m ')[
A
I Son
fllttt
Data
\
Ot
V
R
t\
1
t\
.:.:..:.:.;
; ,;,;;;,;.
)tl !'!i_
,. 'ttpp.,
'!.1Ac!Yan<td
Sort & F
lttt
t
V
1
tv
1
OtvtlOPtt
Add-Ins
Data Vallatoon
:
tr [to Consoli
TtJ<tlo
Rtmovt
Columns Duprocotts Wl\at-h Anat/111
Oata Tools
/x
Can cont
a in
values
Data Validation
--- --
setltn!l>
InPut Me
ssaQe
V.tlid.!Jtion ateria
lL:=
Cust
=
""'
=-
Error
Al
ert
-'
"1 !llrt
-
1-<.B...-u( :B,BJ)=JI
17
:
''R
t;
;j
"
...
Cancel
I [
tiel
J)
.
-.- -- -
P.!.X!it.!.;
Settings
Input flilessage
.
..
:Alert
... . '
i Error
.. ....
;
,.............................
Sl
stop
0
[
Clear All
T tle:
Error. message:
""
v'
OK
I[
Cancel
2
3
4
5
II
7.
10
:.
11
12
13
14
15
16
0 ,
36
45
40
50 2/1/2003
lI
I
17
.E
1/1/2003
1
!-
_J_;
veHere
p
y Here
E" opy
H.rt
.. .Yall.l S.:QJ.lly
I_
-
If you drag a range this way and before letting go you drag it right back to
the original location. you will still be presented with the above dialog, and
this way you can copy/paste special values in place with the m ouse.
40
24
25
26
I
I
I
l
i
l
!
l
-
I
_
Sheetl..(shee.fj?Sheets.,.tb:/
1
Ready
Num Loci<
e:J-f
If you hold the shift key down while clicking one of the inner two controls,
you will scroll a "page" of tabs (all the tabs that are viewable) at a time
instead of one sheet at a time.
41
2.5
2
1.5
1
0.5
Clicking on the coins, copy (ctrl/c), click on a series, Home/paste (or ctrl/v):
3.5 .-----3
--,-
-+-2.5 .J--.!..,L
-I--
--.,.
2 -JI.t.
1.5 +-.L.(!l...:.A-..-1 t-=------Lm,v----..4--1
42
1. Seriesl
1.5
1
0.5
0
..--
t-------.t----t.
.
-+-.-!!}-G:
-
---r
t--.-- ----1':(!fr.===ililbt:=:.___,
+--
Qld
__,
-1--
rl
R
to M! t ch Styl
..
4<t a
Oati Lall:H
Ad d Trtn dli n t
1:
Fill
I
FJ
seriK Op
nt
0 S,elld M
0 G-od.,.tNI
0 e,t11Jrur texb$e ffl
ector
Border SWAct
0 C10 ftl
Onrd
0 Ay:IOflliiiC
Sh.'ldoW
0 lrlw:tifnt:'];Jii'IC!
0 't.-v cdf.Msbypoir.t
J.O fiOfti\Jt
Tcxlyrt:
IM
c
tt ! cm
!Je...
W"
d
I I Qo
I I Clip Att... I
0 ...1<11
0 Sl><t
0 SUCk<it!dScU .,
I
I
IrttCY:
l.:l
,.
lv.":
'()le
ts
ISI!
'
l. !0%
!
a..
2.5
2
1.5
'
0.5
0
1
If we select Stack and scale we can enter a number into the Unit/Picture
box. Again, this is something you can experiment with.
,
Fill
0 ttofl
0 :;oldtil
0 -fil
0 ew:ture ot teXVe II
0 Apma11<
D xrcolnbr...,.
0 flwuta""9"""'
l'$<:
(!<<<ton:
At'lfJit!
Gridentstops
(stot:
or:
44
;;:, ,.--.,
3.5
3
2.5
2
1.5
1
0.5
0
On the picture tab there was a button to select a picture-you can use any
picture you have on your computer! You can experiment with the other tabs
as well.
&
I
yes
H
H
......... .
.............
.
.
.
................
46
Yes To All
No
Cancel
Book2
1
- l
5
6
La
1:1
8
9
10
11
,.
You can click and drag them into the workbook or you can double click
either one to split the window in half.
Here's what it looks like when both split bars were double clicked:
@sook2
Ci:i
21
3
'
I"=
-'Iii
s
6
1
'
..::
9
10
11
12
13
, . I Sheeul sheet!r(rw.
'
..
J
"'
Here's what it looks like when the intersection of the 2 split bars are
dragged up and to the left (before letting go of the mouse button! ):
48
\!1 Book2
1 1::=!
2
B I
1':
iii
.::
8
9
10
11
12
13
14
..>.<
14 4
"'
Sheet! Sheetl!,cl
ua.-1
ij Ll.
1-r
\--
Of course, you can also do this from the Split button in the Window group
of the View tab:
New Window 13 jJ
El
i3 Arrange All '::: ldt EQ
Save
Switch
(f) Freeze Panes L:]
Workspace \h.lindows
Window
If the cursor is anywhere other than column A or row 1 , the splitting will
occur to the left or above where the cursor is. lf you double-click the inter
section of both split bars if they're both present, they will both disappear.
All of the above you may have known. But did you know that the VBE also
has split bars?
I(Generof)
iJ (<
Declarations
Here's an excerpt from a very long routine and where the split bar was used
to help align the If statement with the Else statement since there was a lot
of nesting of statements:
n:
3 jeattA1b
'On
A1
_J
I f n : 0 Then
GoTo 1
'end loop----------------
Else 'yes .xxx
With Sheets("Copysh<Zetl")
.Activate
.Unptotect
.Rows.Delete
Sheets("Al").Rong<Z("H4:H313").AdvoncedFiltel' Action: :xl Fi ltetCop_J
Set Choices : .Rong<Z("A2". "A" &.Ronge("AlOOO").End(xiUp).Row)
Sheeh("Alb").Activote
You can see that the split bar makes the align m ent
code to align the statements!) easier to see!
50
Arrange Windows
Arrange
0[!1
0 HQrizontal
0 Vertical
O ascade
0 Windows of active workbook
o_
K
Cancel ]
\!)Boolol
Ll
1I
_;] [
1:1
Book3
4
5
:I
9
I
u
17
18
li H Sheetl
But suppose you didn't want to include Book3 in the arrangement? Do you
have to close it or hide it? No, you can minimize it (click the leftmost tool in
the upper-right corner of the workbook:
and it won't be
r:
X
included in the arrangement:
51
@sook2
4
5
6
7
8
"'
Book4
1
2
3
4
5
6
9
0
1
11
12
R u dy
Num lock
52
Excel has a bug when you merge cells and try to adjust the row height by
double-clicking the row separator. To see this, merge cells A1 :C1, and also
mark it as Word wrap. Now enter lots of text, then double-click the row
border between rows 1 and 2. Nothing happens. The solution is to make
some remote area as wide as A1 :C1 is, say cell AA1 , and in there, give it the
formula =A1,and also mark this is wrap-text (merge cells isn't necessary
because it's only one cell!). Now, when you double-click the border, the
cell AA1 is being used as the one to make the adjustment, and it looks like
you've got it working!
53
Book5
A
1
2
3
4
5
6
7
Is
r9
l1o
r11
1 12
ru
1 14
rlS
16
17
D ..:.
-- - 1
]
I
l
eetl
Sh--
------
jz.,:.
_
_
!
I
l_,
JI
_i,
__
_l_- lll!
_!,
__
__
--i---''
.......
But if your last cell was XX200000, it'd look like this:
54
Books
JJ
I
B.
5
6
7
8
9
10
rli
11
Notice the difference in the sizes of both the vertical and horizontal scroll
bars between the two diagrams. It gives you a hint as to the size of the
worksheet (a cute tip in itself, if you didn't know it).
If you simply scroll, you're somewhat restricted to the range where there is
data. This makes sense. However, if you do want to scroll faster, and outside
the range of the data, simply hold the shift key down as you scroll.You'll get
to row 1048576 or column XFD pretty quickly!
55
23. Drag/Scrolling
Did you know that if, in a large worksheet, you drag the cursor-that is, you
click in cell A20, for example, hold the mouse button down and then drag
the cursor beyond the bottom of the worksheet, into the area of the tabs
or over the scrollbars-the worksheet scrolls. But did you know that the
farther away the cursor is from the window the faster is scrolls?
I Ay_toShapes
"'-
...._
_
_
If you resize the Excel application window (here you see part of my desktop)
and drag totally outside the window, Excel's worksheet will scroll very fast.
Did you also know that Excel slows down the scrolling (when dragging the
mouse) as you approach the end of the used range and pauses momentarily
when it reaches the end?
56
A
'Ef
...
""'"'
@:
Qp
@ J.eft
eries...
Hl:sheets ..
Justify
Number
A6gnment
Text &gnment
Gnt
11 ProtectionI
FUI
Border
Orientation
tfOrizontal:
G
e
neral
nj
&
t
k
_
ai
_
-:
--- L
o
Bolt om
T
e
X
t
__
Text
Ll
lo
Suppose you have text like this...
A l B
1 1.(
-N
o""
wIS,..;
th
i time! forall &ood men to oomt to the aid oftheir party. Now Isthe tim tot allgoodmen to come tothe aid ofthei rparty.
2
... and you want to fit it all from columns A:E, not A:K. Make the selection as
this:
..
II
Now is tht ume for all good rt1en to come to the aleortheir pany. Now is the time forall good men to col'ne tothe aid oftheir party.
o
3
4
57
purposely selecting a few extra rows, then issuing the Justify command:
rl:sheets
tiltS...
Iustify
Now
4 I
just what you wanted. If you selected A1 :C2 first, you would see an excel
warnmg message:
A
Now is the time for all good men to come to the aicof their party. Now is the
----
5
6
7
8
9
Textwl extendbelowselectedrange.
i oitJ I Cancel J
which means all the text won't fit insideA1:C2.1f that's o k with you, then
you'd see:
D Ais th
58
You can also use Justify to flow the text into a longer string, rather than
shorter strings. If you select A1 :DS from the above and use the Justify
command, then you'd see the text refl owed to:
II
c
--
--
-
-
--
4 of theirp; rty.
---r---
1---
-----
-:, l'r.:
Now
,.,.::,"'
ls"
thi'
2J
LF
tlmr. forall good tnPn toCOIYU! to the tid ofthf"lr party. NQ\v li the timOf'
f all good men to come to the aid l?f their par 1y.
'
Just to be complete, if instead of A1 :M3 being just selected you tried A1 :M2,
(leaving out row 3):
A:=il:
li:JF
No
w
Is
- .
:Ji:
1'1'1en to
< 111
h G
'
No w I s th8
b
H::
I;:
:::; il:
I
I
4 of theirpirty.
LJI 1;, IK
I
I
<
Then the justify would leave rows 3 and 4 out of the result:
A
'
l"'ii_
N_
o_
w_
_
is-:
th-li time for all good men to come the aid of their party. Now is the
2'
3 time for all good men to come to the aid
4 of their party.
----.I
to
59
Suppose you have S workbooks open and you use View tab/Arrange All from
the Window group [Excel 2003: Window/Arrange):
View
Zoom
Developer
100%
Zoom to
Selection
Zoom
Boola
1
Cl
2
3
Add-Ins
Ar ange Alii
@ Freeze Panes.,.
::1
u
BooS
1
Book4
1_
.:!
Wir
<
Book!
etl_LsheeR
..c
>II She
Book3
L.!
The top/left window will always be the active window. But what is the order
of the rest of them1 Probably seemed sort of random, didn't it1 Well, this
author recently learned the "secret" of how to determine the sequence.
If I wanted to see it in this order:
Book1
Book2
Book4
Book3
BookS
all I need do is click the workbooks in the reverse order, from bottom right
(bookS) and up (book4, then book3, then book2, then book1 ). Yes, just click!
The result after clicking Arrange All:
60
Bookl
1 A
1
2
3
4
---st
1:1
8002
1
2
,1
7
8
Ls
>1 Sheen/Sheet2
A I
2
I< >I
Sheetl
Sheet2
-- --A----=8--
--
--
__
Book4
9.
So, it turns out, that Excel's order always was the LIFO (Last in, first out)
sequence you activated the windows. Go figure!
61
Data...
2 Toyota
613
204
3 Oldsmobile
734
4 Honda
961
Ford
876
lincoln
797
340
480
JBMW
676
846
680
780
202
411
436
749
461
589
857
171
262
847
53
7 Mercury
616
254
801
410
728
405
981
919
63
922
568
933
420
720
172
326
139
120
837
77
232
Mustang
241
17
722
889
989
Volkswagen
516
534
908
917
498
Chevrolet
Aif Romoo
and you wanted to name each of the ranges in columns C:G.That is, you
want C2:G2 to be named "Toyota", C3:G3 to be named "Oldsmobile", etc.
You can't simply select A2:G12 and use the Create names feature because
Toyota would be B2:G2, not C2:G2, etc. How about using an intermediate
step? Select A2:A12, use the fill handle to drag to B12:
!
1 cars
2 Toyota
3
Oldsmobile
Honda
5 Ford
6 lincoln
_!_Mercury
8
BMW
9 Chevrolet
Oat<
Toyota
Oldsmobi
Honda
Ford
lincoln
Mercury
BMW
Chevrole
Mustang
.,......,
12 Volkswagen Volkswae
62
then selecting B2:G12 and using Create from Selection command in the
Defined Names group of the Formulas tab (or Ctri/Shift/F3): [Excel 2003:
lnsert!Name!Create]
A
)X-; f9 Recently
- Used
.
Insert
Function
--
/? Usei n Formula
Text
Financia l
Name
Managerj!lli' Create from Selection
B2
H
Data ...
204
Toyota
613
846
680
780
202
411
436
le Oldsmobi
734
72
Honda
961
847
749
461
589
876
340
857
171
797
480
616
254
262
919
53
676
.
801
568
410
728
405
981
720
.
172
326
Ford
Lincoln
Mercury
BMW
63
922
Chevrolet
933
420
AIfa Rome
139
120
837
241
17
889
989
516
534
722
.
917
498
Mustang
kswagen Volkswago
908
232
Dfoilrow !
.
.,......."''''''"'
0 !,eft column
0 !!ottom row
0 !iight column
''[__
o_
K -"j [
Cancel
\B
.,. "<t
fx
c
Data
734
...
204
613
3 Oldsmobile
Honda
961
847
Ford
876
Lincoln
797
734
72
846
G
680
780
202
411
749
461
589
340
857
171
2.62
480
616
254
919
Magic! 63
2 7. Long Names
Name: IThislsAVerylongNameAndNormallyWontDisplal
Scope:
jworl<book
------
New Name
------
CQmment :
B,efers to:
I=Sheet2!$A$1
[I
OK
[J
I [ Cancel J
"'
!toooooooool
f,c
1000000000
New to 2007 is the ability to widen the name box by simply dragging the
little circle indicator as shown (double-clicking restores it to its default
position):
ThislsAVerylongNameAndNormallyWontDisplayWell
A
64
0 __L
_ =._
E
!10000000
fx
hard to see both the formula and the cell. Here's a screenshot from Excel
2003. Notice cell F1 is selected, but you can't see the cell:
rI
.1,
f.
, .,..,..
'
,
,
,.,'lbl<"';,'11..'/.'.blot',J
1:
;J{, '...,_.1"'
:
.,)(
ok
4'!'"..:.fi'.CIH
- .-"'1-:1(,
'N11'(1'1',''r,"fl.:.y';.,.,..','J
/
f.'...,_.,.,.;Sff!-e:.tr,"0::.:."":.:..-:.-..,.;!"," "OK;.J.wJMr,"ft,N
';..,.._.,._. ''.!(,.,.,.',
'l
'th
:v,
. 'A.If..'\ 'ktt...'Oct:W'"
.:.,.
.?-......,_..( "''dl---4f":J ..,...,
;:
."".;.ur.'May',...,..$ :,);,(..q,.nc."Sttt
...t'k#
'Oct. ,
_... ."O.(ot'llbt.f'.'Jtl'loN'f'..,)'-. "N
' -r-..,...tit'---:-.uy.--.w.a;'()c..ft'.":+t
....
.."':
.. A;
"'.tw..t>tl"" '#loli'J'"f -er
;w
.1)
,f,;J,'!;roT(';'Ort:.
II!"C t : ,J-.
'
11'
( ,,_
,'
',
..,"0.:..-&.,..,'Jt.m(',
t
C'
,f,'J..ht','Mr'.'.s.t-....'
.,' O(a.t',t'-."Crt.. ..''-.-,.
,.)l}"'.fii','A:J('
'
*'( 'N", Jt.l'( 'AI.;II',"Sf'CI....
t
. ;
..,-; '1.\K
(:. '
.ti
.;
"Mfl'
).,
..t
' , '.:V1VJ'r',""'-W'
1-{
H'J
','
'
'
:
;'"" o.JM."';;
.._,
- ; ' S.;.: embt,...;O
e
' owr
"':
( ,1! T
', :.
n.,.
M
,
,
.
H
k'f"':
" '" ""
l e
,q
t
:"'M.Wd'i':"A;1ll tt:' M
i.l
1 ,H
l:l.I*Y
..
But you might wonder where's the rest of the formula? You can drag the
formula bar down, or double click it to see both:
11
""-
.....L..._,c,._j
f1l"
J<fh\Jo!y-;"f'cttwry";"M-ar<.t":'"lt;lrtli.-..,..,.-:June:-:to'l'i"':;.\.W,at";SttN'Ir;.,O<.tob<:r'";r\o-o'<''";
...J.
1 <>
'''""
;;;I
t.
W
d
'
i; J
..
'0\.'<1!M'!tr;"tAuMY"'t'fCbfl1oi'J":
J_,.i;,j
.L.<IJ
As you can see, when the formula bar is expanded the worksheet moves
down to accommodate it. You can use Ctri/Shift/U to open the formula bar
to fit the active cell. And press it again to restore it to one line.
This isn't
65
/Bob Umlas:
l
'
Bob Umlas:
Bob
66
....
Comment3
12r--
13
14
-
E
is a typical comment
1
5I
-'
161
17J
___...
You need the "Change Shape" tool. This can be placed on the Quick Access
Toolbar: [Excel 2003:View 1Too/borsl DrowingiDrow Menu !Chonge Autoshape)
.
.
.
'
!l,9P.
.!i
i!.
.S
..
Popular
Formulas
Add-Ins
Trust Ctnttr
Ruoura\
All Commands
Save
Cu\torn1u
Ac.ces'\T.
,'3 16r.
'' 9
Proofing
Advanctd
-rr,
-..
Changt Layout
Chart Background
Chart Data lablt
Chart Eltmtnts
Chart Floor
Chart Gridlints
Chart Layouts
Chart Namt
Chart Ptoptrtles
""-'
''
>
=..>
,.=:,..
...,
.:!J
Add >>
"
- me
When the comment is selected by the border, click the new Change Shape
tool.
This isn't
67
@liD IY w
r8 '
ISiti>
J) ;;
BO<
l
c:$
a
Psle
Olpboard r;
Com
ment3
12
13
Font
8 I
...
81
0<1< A
rr
oW>
DO<>OO[jGJ(;'k>OCJ\J
o o O t?Ee & 6 \7 G D
QEJOlO
14
15
Cal lOUIS
16
Q 009-DAJ,-o
<PJ.J "
__jtf-j)
. I -, -1
r
o ...
O
' ti
O
..L. A, r
"". C . 1
a
17
"
I
18
Starsand 8a
_nners
lg
J!.
20
..
..
From that, you can select basic shapes, block arrows, flowchart, stars and
banners, or callouts, each of which has yet another set of shapes to choose
from. Shown here is the Cloud callout:
cauouts
.. . .
.J......
..J /:,....
.,
/
i [1
...: r:,....J. c.....;. JO '0
ri,..,
'
L::J
Once you have the new shape, (cloud, here), right-click the border once
again and choose Format comment, as shown, if you wish to format this
comment even further:
g.
1
m;
i:
;::
N:
>
:
: :>- ttt!!t
,.J
i'''=
I
I
l
I
I
I
J,
op
faste
..J 5) Edi tTe
iii'
'
-=-
68
Cu!
Grouping
>
Order
Asign Ma<ro...
Set AutoShape Defaults
Format Comm.ent.-. .
!jyperhnlc..
I.
That will bring up yet another dialog, from which you can choose Fill Effects:
------
Format Comment
Font
Ft1l
II
Colors and l in
es
olor:
tv"I
NoFtll
Iransparency:
ne
l
------ - - -
C:
shed:
Connector:
MOWS
aegin style:
Begin s[ze:
[
I
luooouco
oo o
[1(-
Mor e Color s
. .
Eil E ffects . . .
Fill
..
Io "'o
Automatic
II
Web
Si2e
!o.7s pt
I[
Cancel
From this dialog box you can select the Picture tab and import any picture (I
chose me!).
rill flfor.ls
------
rEl
Setect Pictur
e. ..
sample:
0 ol
t fill elfe<t l!llh sh a pe
69
r -
!!
' l!lghllght
F
F
1m
for
matting " as Table .; t
Syl e s
Cond1t1onal Format
"
,;
Cll
I ngr:;l
li!l
Iop/Bottom Rules
Qata Bars
Colo r Sotes
(con Sets
!j ew Ru l e ...
Itar RuiH
Mana g t Buies...
3. Select the Rule Type "Format only cells that contain," then pick the Errors
rule from the dropdown:
Mt
-
-
l. !''.'!.'!_l!l!.e.,!l}- r@
lect A Rule Type :
1>
det2rmine whi
ch cells to
forrnat
iii..H.rc
'
"
'
",'=
" il
!..
..;...,.,g:.
,-...,-...
i_ '"'
oo> i
Prevlew:
70
No Format Set
IL
OK
'
II I
fo
r mat. ..
Cancel
I
I
4. Click the Format button, the font tab, and assign a white font!
'
'.It'
!
)
8<dy)
ve
"
"-
R..P.,
nw.
Sold
Sold ltak
IEff ects
Size:
Fgrt style;
051<\elt'<OUti>
' r
LJ .'(A,:,('
8
9
13
I!
I
"
"
--
14
Automatc
Them4!Colors
FoUII
fxlore Colors...
OK
II
Cancel
This isn't
71
17
C6
21I
jl
'
x:I =SUM(Bl:85}
--
3:15
4:15
'
5:15
6 15
7:15
2: 151 26:151
72
This isn't
73
Home
Insert
Calibri
Page Layout
Formu las
Data
Revi
11
Al
B
can be formatted by ch
3
4
5
6
II I I
ardCo
l
ors
=
\;)
,More Colors...
the word "Text" is selected, and the red font color is being applied. Only the
word "Text" will be red. You can also access the font by right-clicking once
the word is selected.
74
u......
... ,
fx
0 00 0 0.
Use a format of $**#,##0 to get asterisk-fill for currency. The first * is the
code indicating to use the next character to fill the cell. That next character
is *, so now 1 2 looks like this:
Al
1
2_
... (
12
fx
$*************** 12.00
75
6 I Sub Sections
7 Sub Sections
Main section
9 Sub Sections
10 Sub Sections
11 Sub Sections
12 Sub Sections
13 Sub Sections
8
14 Main section
15 S ub Sections
16 Sub Sections
17
18
19
Sub Sections
Sub Sections
Sub Sections
and you want to indent each Sub section a few cells. In this example, you
could replace the word Sub with" Sub", but in reality, each of these cells
would contain other text.What many people would do is laboriously click
in each cell and type a few leading spaces! But what about this:
Two clicks of the indent button on the alignment section of the Home tab:
[Excel 2003: Format!Cel lsjA/ignmentllndent up-arrow twice)
Alignment
works just fine. It's a command also found in the format cells dialog (ctrl/1,
alignment tab or the bottom right arrow of the above illustration):
"'J,
p
y_
-;,.,.-
gmt_a.l;
-
Number
Alignment
Font
Border
Text alignment
I (Indent)
e
:
IBottom
j[
Fill
vi Indent:
g
vi
Horizontal:
Left
V rtical
Distributing text is found in the same Format cells dialog. Here, cells A1
and A2 contain the text "This is a wide cell," but cell A2 was formatted as
distributed:
is is a wide cell
is
F;mat
is
wide
cell
Font
Border
_
_
,
.-.
"
'
'
'
r
" .,_
_lfm
Ce l ls
.
.
4 'U
,
'!'
...d
7
8
9
10
11
12
13
14
Number
Alignment
Fill
Protection
Orientation
Text agnment
ttorizontal:
(Indent)
lndent:
lo
T
e
X
t
Text
This isn't
77
Al
_!_.,
:;
;lA_!
2 B
fxI =CHAR(ROW(}+64)
31c
4 .o
,
5 IE
------- ------
1'---
D . .!lJ.C.IOp,lio..'
Hom
,)1
-
Pat "
!1pboir<J tv
Al
-
-=
1 A
A
_3_ 8
3
c
-
..1_0
5
6
E
F
ILPopula
Formulas
Pfoofino
Savt
ACS.Jn<cd
u1tomirt
Add-Ins
t;olor sd1eme:
Tnnt Center
S<{l."tnTip 't y( t:
Show
Ruourcu
78
'=
Blu
'=
:::!
i:J
:L
-:1
__
__
__
__
__
__
_
_
_
--- -IM"i)rv;)
Custom lists,.lj. - l!!:J
,_,
.
,.
-.
u
.
,.,
,,
_"
Custom llt s
Cus
tom
list ntries:
NEW LIST
Sun, Mon, Tue, Wed, Thu, Fri,
SUnday, Monday, Tuesday, Wee
Jan, Feb, Mar, Apr,
.lul, J
[ &dd I
--. [
I
:6
A
B
c
Qefete
0
E
F
G
H
I
J
I(
===::.
[::JC:;
-,
,. ==
.-
$A:!.
$:.:
!!:
:$
A
=
$2
=
6--
::.:
::l
'<
-
l
L.:!
OK
I[
Carocel
Now, you can enter any letter (upper or lower case), and use the fill handle.
I f you entered upper case, it will fill with upper case letters. Lower case will
fill with lower case letters.
This isn't
79
86
A
1 Rate
Ji..__ B
Lc
I S1,75o.ooI
$1, 4 .
$1,745
7.98
$1,743.95
99
10
$1,74
7 1. 2
$1,739.88
11
12
13
I E
$400,000
0:00
3 PV
5
:IPMT($B$1/12,ROW(A1),$B$2"'l2,-$B$3}
5.25%
2 ' Nper
4
f,.
$1,737.8
92
$1,735.76
--- ---
1-
---!
When the formula in cell 86 is filled down, the part containing ROW(A1)
becomes ROW (A2), etc. This is, of course, 1 in 86, 2 in 87, etc, giving the in
ner senes.
You can also use COLUMN(A1 ), of course, if the series needs to be filled
rg
i ht!
80
.r
82
B
.
1
3
nl
1 =B5+86
tx
4
4
First
Second
11
4
s
7
8
9
10
11
F irst
Second
,owJ
0t!i1:;:..;;:e ..........
0 eft column
....
Oaottomrow
0 fii<;lht column
OK
JI
cancel
then after naming them you can use Apply Names from the Define Name
dropdown in the Formulas tab, [Excel 2003: lnsertiName!Apply) and these will
already be selected in the dialog:
Formulas
Data
Reviw
Name
Manager
View
Developer
Define Name...
-=
A:B
pply Names
-
..
Defined Names
81
..,...
...
!:-;;
"'("
P.! X. !'-1.
0 !gnore Relative/Absclute
[Qptions J
] [ Cancel
B2
1
2
3
4
5
6
7
82
...
J;>.
OK
C:t
(..
- ; .
.c
Iii'
11
First
d
>>
4
7
'
=First+Second
-.0<
2
3
f,. =RAND()<O.l
lteml
ltem2
TRUE
4 ltem3
5
ltem4
ltem6
lte m7
ItemS
10
Items
ltem9
Using the Advanced button from the Data tab: [Excel 2003: DateiFilteriAd
vanced Filter]
Formulas
T
Filter
Data
o( Clear
Review
:{ Reapply
,
LV
A
dva n c.,
I
83
Advanced Filter
Action
!.ist range:
riteria range:
-"11 .)
'
I$C$1 : $C$2
::::
==
:
:.:
::
==
L
I
_:::.:.J-:1
_
_
_
_
_
_
_
_
OK
I[
Cancel
13 ltem12
16 ltem15
27 ltem26
62 ltem61
n ltem76
74 ltem73
86
ltem85
11-
This will be different each time.You may notice that there are only 9 items
shown, not 10, and that's because the values RAND returns are random! It's
best to use this on larger databases!
84
A second way to select a random 10% of your data is to still use the RAND
function, but not use filltering. Look at this:
A
r-
.,
ltem1
ltem2
ltem3
0.161792
ltem4
0.236491
ItemS
0.255978
ltem6
0.786952
ltem7
0.810523
ItemS
0.227744
10 ltem9
0.2444
0 .472988
0.754415
11 ltem10
0.170091
12 ltemll
0.506724
13 ltem12
0.073749
14 ltem13
0.186336
15 ltem14
0.498387
Cells B2 thru B101 contain =RAND().AII you need do is select A2:B101 and
sort by column B! Take just the first 1 0 items, and you have your random
1 0% of the database!
This isn't
- - .Joeeartment!
IAccounting
3 Accounting
4 Accounting
5 Accounting
6 Accounting
7 Accounting
8 Accounting
9 Accounting
10 Personnel
11 Personnel
12 Personnel
13 Personnel
14 Personnel
15 IS
16 IS
17 IS
18 IS
86
The choices I'm usi ng are any two of Number,Text, Logical, Error because
of this:
Go To Special
Select
O co ents
o cnstants
0Eormlasl
0 Row differences
mm
0 CokJmn differences
0 Erecedents
0 Dependents
N!lmbers
D ecc orI
Tet
logicals
:.l .evel>
Lat cell
0 Blan!ss
0 Current tegion
0 Condonal formats
0 Current rray
0 Data yalidation
AI
0 O!ljects
!,
Same
OK
1) I
Cancel
Assumi ng we choose the first formula, then the NA()'s will show on every
new department:
B2
6
7
8
9
10
11
12
13
14
..
A
Department
Accounting
Accounting
Accounting
Accounting
Accounting
Accounting
Accounting
Accounting
Personnel
Personnel
Personnel
Personnel
Personnel
15 IS
16 IS
#N/A
1
1
1
1
1
#N/A
1
1
1
1
#N/A
1
1
17 IS
18 IS
87
Select column B. Home tab, Find & Select, Goto Special (or simply press FS):
[Excel 2003: EditiGo ToiSpecial]
rt
I:
liD
te ""
nat
at&
3
" 3C
Sort &
Find &
Filter Select
find...
Replace...
Go To...
Go To pedal...
Formylas
Comments
Conditional
Formatting
Constants
Data Validation
ln.
Select Objects
select Formulas + Errors (you actually have to deselect Numbers, Text, and
Logicals, leaving just Errors, or just deselect Numbers because you know the
result is only numbers and errors):
-
Go To
[8]
Special
Select
Oomments
0 CQ:nstants
@Eor!Was
0
N11.mbers
0
Te;![t
0 .
ll.!i
0 R diferences
0 Colu(!11 differences
Oecedents
0 Dependents
0
.... ._....._..,
0 '-rrors
0 Blan!ss
0 Current region
0 Current rry
0 O!lJects
.
!
<;
'..
.
.
0La cell
0
88
ct or'
All
Same
Cancel
J[
Now only the #N/A cells are selected, so you can use Format Row Height
from the cells group of the Home tab [Excel 2003: Format/Row/Height]:
o Insert
Delete
Sort &
i!) Format (2 Filter
Cell S"12e
:c
:
++
Find &
Select
'
Row Height...
Visibility
1
_Department
Accounting
c:J
4 Accounting
5 Accounting
2 Accounting
3
6
_Accounting
7 Accounting
Accounting
9 Accounting
10 Personnel
#N/A
11 Personnel
12 Personnel
Personnel
Personnel
13
14
15 IS
16 IS
1 7 I<;
#N/A
1
1
89
.ayout
cal
Data
! & T1me
Review
Name
Manager
Library
View
Ac
Developer
JP Use in Formula
L.
l
_
_
New Name
ame:
cope:
CQmment:
&efers to:
IA bove
--__J
I ======;
vI
Workbo ok
l=dll
[J
--==
, =
= ===
jr
[=c==
aoc
elj
;
/.
lL.--1
E
--
-- -
Nd/JlC Manager
Mew
Ed
Delete
filtw
So any time I use =Above to reference the cell above the active cell, it will
always pick the cell from SheetS! That is, if on Sheet5, cell A1 I have "Bob,"
then if I enter =Above from Sheet1 cell A2, 1'd see "Bob."
90
Interesting side note: if the active cell is in row 1 and you use Edit/G o To and
type Above, the active cell will be in row 1 048576!
To get "above" to be the cell above on any sheet, do one of the following:
1 . Leave leading "!".That is, define "above" to be =!D1:
1
--
me:
I._
_
_
Edit Name
6
7
C2mment:
8
9
lAbove
...
rill
I
"
-
10
11
12
Befer> to:
13
14
1101
II
OK
tI
l I Cancel l/
t'2]
I
New Name
!!lame:
ope:
C:
&efers to:
[Above
lworl<book
vi
[&indirect("r[-1)<",false
I OK l I
11
Cantel l
The difference between the 2 choices is that the latter will calculate auto
matically, and the former won't (without forcing a calculation with the F9
key).
As a side note, you probably shouldn't use this technique if you're also using
VBA because there's a bug that when VBA recalculates, all cells with that
name refer to the active worksheet!
This isn't Excel, it's Magic!
91
[ZJ[?SJ
ew Name
ame:
2cope:
CQmment:
Refers to:
lk
====
IWor==
kbook==
l;'
I ----------
:========!....__ ----------.,
lL=_
lin
..
ks_,
O..: I,_--;=
A1
92
This
] [ Cancel J
:;-;:
=
::::!
:=
(:;J
=
=
=
=
II_
As you can see, cell A1 contains the formula as indicated, and it returns
the entire link path to the first link document. The workbook is linked to 3
workbooks, named del1.xls, del2.xls, and del3.xls. But the Edit Links dialog
(from the Connections section of the Data tab [Excel 2003: EditjUnks])
Insert
Home
al
If
Mi} Connections
u
H
Refresh
All
Connections
Data
formulas
Page layout
lill1 1
.,A Oear
Reap1
filter
Sort
Advar
Sort filter
Location:
Item:
Updote:
I Typ e
WN I s he et
'
Woksheet
Worksheet
Updote
A
A
A
[ evalues ]
[Chaoge s-ee.. I
Stotus
Unl niJwn
Unknown
Unknown
0 &utomotl<
[tMtuP Prompt... I
------
Open
,.:
(j o..stop
e.
!l ""'
Ccnpltcr
lo
:1-2000
...
..
vt:!]
I!Joz
".""
i!) O>-OQORl.>i<
!)-thTI\O.JdJ
i!)OKLOSEA\IG.xb
i;!)os-5'{EO.x
ONN:>lRCTZ.>I<
..,Network '!!J
1!.)07-IN:>IAE CT.>CI<
Pious
i!!)oe.F1Nlt11"H.><IJ
"!)09-15
1
K
1 m . xls
10<-IAXOATt.x
111fX1SOAT.>k
12A'.rne.xls
'e!.)13-SORTP'I'!0.>4s
z<
<9 1<8
38 1<8
IS 1<8
35 1<8
Z'ISIC8
221:8
Dote-lid
ty pe
t'icro$0lt<:ifK.c Extd
Mcrosott cttlc:cElCCeJ...
Mcro$01tfiai xcel
Mcn>$011: ctfi<eExul.
.
261<8
30K8
3/1?/2000 IMZm
3/1212000 10:57m
3{12{2000 tO:><m
3/12/2000 10:221'1'1
3{12/2000 10:31 1'1'1
3/12/2000 10:571'1'1
3/l<f2000
9:35""
3/12/2000 10:571'1'1
3/12/2000 10:31FN
3/12/2000 10:57 FN
3/12/2000 10:26 FN
I0:II I'N
3/12/2000 10:57 I'M
3112/2000 10:57 I'M
3/l2f2000
93
By defining a name like FL, for example, to be =FILESQ, you can get this
directly into your worksheet:
I =INDEX(FL,ROW()}
c
A _
...,
I _:...:.
...._ -,\1. ____B_.: =---I
1
01-ARRAYl
.xls
!
Al
fx
2 02-SUMIF.xls
3
03-0KSORT.xls
04-MatchTwo.xls
J
5 05-CLOSEAVE.xls
4
6 06-SPEED.xls
7 ,07-INDIRECT.xls
8
07-INDIRECT2.xls
08-FINONTH.xls
10 09-ISINCELL.xls
11 10-MAXOATE.xls
12 11-TEXTSORT.xls
13 12-Prlme.xls
14 13-SORTPTNO.xls
Another nice feature of this is that you can fi Iter on the files. For exampie,
if you wanted to return only those files which have an "0" in them, you can
use =FILES("*O*") where the asterisks are wildcards:
A1
A
!_103-0KSORT.xls
f
!
04-MatchTwo.xls
2
3
"'I:INOEX(fi,ROW())
B l c
0
Ndlllc
05-0.0SEAVG.xls
__,
4 11-TEXTSORT.xls
5 1
3
-S
ORTPTNO.xls
__,
6 14-WilCOX.xls
94
Manager
fjew...
fl
II
.....
...
II
Refers To
=FllES
(" ' O '")
Scope
WoM.ook
This isn't
95
.tL.!l"iS&
New
Name
Cl unique
lI
dit...
)[
Value
{ . .}
.
tlelete
Refers To
-S....-(1/COTlf(Rg,Rg)).
Scope
Filter
Convnen
t
Workbook
.!;
Refers
to:
jX)f./1 lsur(I/COUNTIF(Ro,Ro))j
'1'!)
t.>-11
!I
I Close l
if you
entered it as
However, here's an oddity. If you enter =A1 :A2 in cell A3, you'd see #VALUE!.
If you array-enter it, you see whatever is in cell A1 . 1f, while the cursor is in
cell A3, you define a name to be =A1 :A2, then entering that name in A3 still
produces #VALUE! If you array-enter that name (like {=test}-the braces
supplied by Excel) then it returns A1 's value. So these techniques seem to
contradict one another!
Just be aware that your named formulas may be different from what you
expect only because it's likely interpreted as array-entered!
96
This isn't
97
Put another way, =WEEKDAY(38353), where 38353 is the serial number for
1/1/05, is 7.
Comparing this sequence of numbers-{7;1 ;2;3}-to a 4 changes these
numbers to a series ofTrue/False values:
A3
A J
....!.... 1/1/2005
2
fxj{:WEEKDAY(ROW(INDIRECT(Al&":"&A2)))=4}
3/5/2005
FALSE
98
C
U BEMEM. ..
...
( t. 'X ./ ,
..
={FALSE;FALSE;FALSE;FALSE;TRUE;FALSE;FALSE;
FALSE;FALSE;FALSE;FALSE;TRUE;FALSE;FALSE;
FALSE; FALSE;FALSE; FALSE;TRUE;FALSE;FALSE;
FALSE;FALSE; FALSE;FALSE;TRUE; FALSE;FALSE;
FALSE; FALSE;FALSE; FALSE;TRUE;FALSE;FALSE;
FALSE;FALSE;FALSE;FALSE;TRUE;FALSE;FALSE;
FALSE;FALSE;FALSE;FALSE;TRUE;FALSE;FALSE;
FALSE;FALSE;FALSE;FALSE;TRUE;FALSE;FALSE;
FALSE;FALSE;FALSE;FALSE;TRUE;FALSE;FALSE;
FALSE
8
A
1
II
1/1/2005
3/5/2005
3 .. ;FALSE}
.!
I
.
.
This isn't
99
_!_
------M
a
e r
l i
-----1
2 IFi rst
Last
Amount
3 1 Bob
Fred
S IBob
Bob
7 John
8 Bob
Smith
23
Williams
Devon
Williams
78
45
Smith
89
Clinton
67
34
Jones
9 Bob
10 Bob
12
McCarthy
56
and elsewhere in your workbook you have a first and last name for which
you'd like to find the amount value.That is, you have Bob Williams in F2:
G2 and you need to pick up the value from cell C6.You can't use any of the
LOOKUP functions, and you can't directly use the MATCH function either.
What to do? Here, an array formula comes to the rescue:
H2
fx (:INOEX(C:C,MATCH{F2&G2,$A$1:$A$21&$B$1:$B$2 1,0))}
+f
lrst
Bob
4 Fred
s Bob
6 Bob
7 John
8 Bob
9 Bob
10 Bob
,
B
c
Master List
Last
Amount
Smith
23
Williams
Devon
Williams
Bob
Fred
B
ob
78
45
G
Find
Williams I
Williams
Clinton
34
1
78
67
34
89
67
Smith
Clinton
Jones
u
56
McCarthy
F2&G2 becomes the string "BobWilliams," and this is being matched against
A1:A21&B1:B21 which, when selected in the formula bar and the F9 key is
pressed, expands to:
i
NDEX(C:C. MATCH(F2& G2.("Maslerl.Jsl";1'irSI I.0$1";"8obSrrilh". "Fred'IViliams":"Bob0evon";"BobWilliams";"JohnSmilh";"8obCiu11on
i
'"
'"
'"
BobJone$:"'Bot>McCanhy"; ":: ":-:-;;::: },0))
..
.. .
and you can see that the combination BobWilliams is the 6th item in the list,
so this formula reduces to =INDEX(C:C,6), which is C6,so the result 34 is
returned.
100
ame:
2cope:
cQlllent
l!l
:
B.efers
to:
IDatabase
I
========--
Worlcbook
I
VJI--
==========
"
-
Sheeti!$A$1 :$E$2S I
[
J
=====;r==
=;
Cancel
1
l
1
OK
You add a record to row 26, and then need to redefine the range to include
the new row.
Assuming there are no "holes" in the first column of the database, change
the definition to be =OFFSET($A$1,0,0,COUNTA($A:$A),5).
This means starting with cell A1 , 0 rows down and 0 columns over, in
COUNTA(A:A) rows by 5 columns. (COUNTA returns the number of
non-blank cells).
This automatically will include new rows added because the COUNTA re
sult will change. lf it were now A1 : E25 then the COUNTA function returns
25.When you add a new record, the COUNTA returns 26, so the new
definition is =OFFSET (A1 ,0,0,26,5), or A1 :E26.
.
101
txl =REPT("/\",500)
C
=-t-..__
II\/\/\JV
:.
_.:_ tv
.____ \l
vwVV\1\MiVVVV
2 -
--"--'
3
-----
lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
40<X>OO<XO<>Oo<X>OO<KX>OC<X>Oo<>OO<X>OO<>C
'i
102
I =West Gizmos
! c J D
fx
North
South
West
1Thlngs
Gizmos
37
85
Objects
53
74
24
51
s
9
1n
I
I
East
92
91
39
98
58
--
E.
ssl
I
1
I
Here. West is defined as C2:C4, and Gizmos as B3:E3. They intersect in C3,
which is the result you see in cell C9.The space operator is an intersection
operation.
103
1<2
2
1
104
...
1> =MID(A1.SEARCH(CHAR(222).SUBSTITUTE(A1,'\".CHAR(222).
-...........,.
,
..________...,.,.
lEN(Al)l.EN(SU9SllME(A1,'\',"))J)I .Z$)
C:\MSOFFICEIEXCEL\LIBRARY\MSOUERY\M
.li)
le.xls
M
yFile.xls
,, .n
.2...
3
A
'
Fred
Fred
Fred
;&
__!..
9
Fred
...2004ifred
' .., .. ..... ,
. .
20031 Bob
; treo
,10
11
Ill
l
3
4'
6
8
< II
m1
UCT((1''11
1l1lJ.
.I
UcT((I' ? "11
Fred
111
-"D.-1)") )
I
{A
2
:
A l1=
20
04) --(B2:Bll="Bob") C2:Cll}
10;. :SUMPRODUCT(
'
--
.
-- ---
Cell D4, which contains the formula shown in DS, returns 1 1 .This is the sum
of the amounts in column C which correspond to the year being 2004 and
the name being Bob. That occurs only in rows 3 and 1 0. The formula works
like this: The part of the formula which is A2:A11 =2004 evaluates to (what
you'd see if you selected that part of the formula and pressed F9):
{FALSE;TRUE;FALSE;FALSE;TRUE;TRU E;FALSE;FALSE;TRUE;FALSE}
where the TRUE's correspond to the 2004's. B2:B11 ="Bob" evaluates to:
{FALSE;TRUE;FALSE;FALSE;FALSE;FALSE;TRUE;FALSE;TRUE;FALSE}.
Now these are being multiplied together. Only TRUE *TRUE is 1 , any other
combination is 0. (You can try it in a cell-enter =FALSE*TRUE, for ex
ample). So this produces {0,1 ,O,O,O,O,O,O, 1 ,0}, where the 1 's correspond to
a pair ofTRUE's. Now this in turn is multiplied by the range in C2:C 1 1 , or
{1 ;2;3;4;5;6; 7;8;9;1 0}.This multiplication yields {0;2;0;0;0;0;0;0;9;0}, and this is
added up to produce the 1 1 .
Cell D7 (formula shown in DS) only returns the {0;1 ;0;0;0;0;0;0;1 ;0} part of
the multiplication, and this is added up to produce the 2-which represents
a COUNT of the number of records for which the year is 2004 and the
name is Bob.
You may have seen another variation of the formula in cell D4. Cell
D1 0 contains the formula shown in D 1 1 . What is the"-" before
each set of parentheses? If you enter =-TRUE in a cell, you'll see -1,
=-FALSE yields 0. So --TRUE yields 1 , and --FALSE still yields 0. The
This isn't Excel, it's Magic!
105
=SUMPROD
UCT({0;1 ;0;0;1 ;1 ;0;0;1 ;0} ,{0;1 ;0;0;0;0;1 ;0;1 ;0},{1 ;2;3;4;5;6;7;8;9;1 0})
A side note: you can also use the new function in Excel 2007, SUMIFS.The
formula in cell 04 would be =SUMIFS(C2:C1 1 ,A2:A1 1 ,2004,B2:B1 1 ,"Bob").
The syntax for this function is =SUMIFS(sum_range,criteria_range,criteria,...)
1 06
c I
...J.:H.:....__:..__c__
------m
formdl Cells
General
.....
Wednesday, 11/1/2006
Cunency
Ac<olrtln'l
o.to
Time
m/d/
Y'/Y'I
Penent90
Fra<tlon
Scient1k
Text
--
'd
:J
r)l
tnsert
Cahbri
fB
Page Layout
11
JI JI
Formulas
[A A1 1=
Data
Review
View
er
De
velo
p
&
I I
e;JIj
:trJ[iF tl
General
s %
118 +81
Wherever you see this little arrow, it means you will be presented with a
dialog, very similar to what you saw in previous versions of Excel.
This isn't Excel, it's Magid
107
C2
....;__.oept
Deptl
3 Depn
4 Depll
5 Depn
'
6 Depn Total
7 Dept2
a oept2
9 Dept2
10 Dept2
1l Dept2
Amt
f
j(:B2/INDEX{B: B,MATCH{"'Totai",OFFSET{A2,0,0,1000,l) ,O)+ROW{)1)}
" ofTot
al
ani
30%
13"
2919
340
100%
10%
23%
794
762
426
367
207
122
459,
3247
671
H i
30%1
86
9
384
564
16 Dept3
c j p
II
27%
13%
11%
6%
4%
17%1
14%1
100%
4%
The formula in C2 is filled down as far as necessary (past C16) and yet it
returns the percent each number in column B is to the total value for that
department. It's based on the fact that the total is indicated in column A by
text ending in the word "Total."
Part of the formula uses an asterisk inside the MATCH function:
=MATCH("*Total will look for anything ending in the word Total (case
insensitive). So, cell C2 is dividing B2 by that number in column B which cor
responds to the next Total, or in this example, it's B2 divided by B6.
Let's examine the formula more closely. =B2/INDEX(B:B,MATCH("*Total".
OFFSET(A2,0,0,1000,1 ),0)+ROW()-1 ) in this case winds up being =B2/
INDEX(B:B,6), which is B2/B6.The part we're interested in here is how the
6 is derived. And more specifically, how this same formula in C3 through C6
returns 6 and how in cells C7:C1 5 it returns 15.
Okay, back to cell C3. =MATCH ("*Totai",OFFSET(A2,0,0,1 000,1 ).0) is the
same as =MATCH("*Totai",A2:A1001,0) because the OFFSET function as
used here says to start with A2. go 0 rows down and 0 columns over, and
use a shape of 1 000 rows x 1 column, or A2:A 1001. This part returns 5
because the MATCH function never returns 0-it's a value from 1 and up,
or #N/A if not found. An adjustment needs to be made. We need 6, so we
can just add 1 ! But that seems like cheating. And in C4, the MATCH would
return 4 and adding 1 wouldn't be right; we'd need to add 2! In other words,
1 08
we need to add one less than the row the formula is contained in: in C2 add
1; in C3 add 2, in C4 add 3. So in cell Cn, add n-1. Now look at the formula.
We're adding ROW()-1.
I've added a column in this next illustration which is simply the part of the
formula from the MATCH on:
07
Amt
1 'Dept
2
0eptl
0eptl
4 0eptl
5
0eptl
0ept2
0eptl
-.!l
Oept2
9 oept2
10 Oept2
11 0ept2
12
13
-
Total
l
I
14 Oept2
15 0ept2
Total
=MATCH('"'Total",OFFSET(A7,0,0,1000,l},O}+ROW(}-1
C
% ofTotal
30%
872
869
30%
13%
384
794
27%
100%
2919
340
10% I
23%I
762'
426 r- 13%
367[ 11%
6%1
2071
4%
1221
'
0ept2
0ept2
/.<
'
'
5641
459
3247
17%'
14%
100%
---
151
151
15
15
1.
15
15
151
--
1
i
I
1
i
r
I
r
--
What makes this formula interesting is that it can be filled down as far as
necessary without knowing what row the total is in.
109
148
149
150
151
"
"
152 ...
153 TM
154 s
155 )
156
157 0
158 z
159 y
160
161 .I
162
163
110
1
1 Data
Data
Data
4
s
Data
Data
Data
Data
Data
Data
Data
Data
Data
Data
Data
Data
Data
Data
Da ta
Data
Data
Data
Data
.Data
, Data
'Data
Data
Data
:Data
Data
Data
Data
Data
Data
#the rows- en
t er 1 in E1,
2 in E2. Select El:E2,
double-click the fill handle
Data
'Data
81
91
'
:oata
Data
Data
iData
Dataa
8 a
2
3
Data
Data
D ta
10
1l
12
..!.
14
Dat
Data
'
Da
DData Data
tData
Data
Data
Data
ata
D ta
ata
Da a
'
Data
IData
Data
Data
Data
Data
Data
Data
'
-...-s'-
ll
Data
21
_j
Data
Data
Data
Dat
a
Data
4
5
6
Dat
a
Da
ta
Data
15
6-
17
7
8
16
18
111
3. Sort the data by this column.This sorts the blank rows into their correct
place.
A
1 Data
B
Data
c
Data
Data
E
1
1
3 Data
Data
Data
Data
2
2
5 Data
6
Data
Data
Data
3
3
7 Data
Data
Data
Data
Data
Data
Data
Data
10
11 Data
-
Data
Data
Data
12
13
Data
5
Data
16
17 Data
-
6
Data
Data
14
15 Data
7
7
Data
Data
18
Data
Data
Data
Data
8
9
4. Clear the column, and you're done! You can use this technique to triplespace by pasting another set of row numbers before the sort!
112
Yo u've probably wanted to be able to fill a formula horizontally and have the
resulting formula reference a vertical range. That is, you may have entered
=A1 , and wanted to fill that to the right but have the result become =A2,
=A3, etc. Of course, Excel gives you =B1, =C1, etc.
This is not a substitute for either the Transpose function or copy/Paste
Special and che cking the Transpose checkbox. We want a dynamic and simple
formula reference as a result.
Here's a te chnique that shows you how to do this.
1.
Enter the first formula without"=". Here, B2 was entered in cell B12. The
B2 is used because that's where the data starts.
'"I!
1
2
3
4
s_
6
7_
8
9
10
-+
B..-+
""-
I
)Here's
I
lth-e r: infrmation1
'to
see
left
:...._
to
right
_
_
__
_
11
82
113
2. Fill
I'1 I A [
2
Here's
the
.B
to
see
left
to
right
information
--
10
11
ls2
12
B3
B4
B5
Fi!!dwt>ot:
Rlace wi
t h:
[=
s ============="'
f
:g]
L-----------------------[o;=
p==
M=>>I
8
1 v,
f[nd All
I ( Eind
Next
I [
Close
1
2
3
Here's
the
informati on
to
see
left
to
right
10
11
12
114
IHere's
the
lnformatlc to
I o I
-:- .
Here's
fhe
1 info
Ir3c3 l
T
'
F
to
- ee
to
left
right
1-
Here's
- the
r3c3
r3c4
r3c5
r3c6
r3c7
Info
-
to
G
see
H
left
I
I
I I
to
I
I
right
115
3. Switch to R 1 C1
2003:ToolsiOptionsiGeneraiiR 1 C1]
J)J:cel Optioi'\S
Popular
11, F'o1mu1as
Proofing
formula calculation.
Calculation options
Workbook Calculation())
Save
0 Automatic
Advanced
Customize
Add-Ins
Working with f
Trust Center
Bf
a reference style
0
0 ,Eormula AutoComplete0
0 Use table names in formulas
0 Use GetivotData functions for PivotTable references
Resources
4.This step is necessary, because you can't replace r with =r in the above
because Excel will give you an error message:
c
Here's
ov
..... ......
K
-
"
J
I
An!l
.........
.........
.
ReQiace
Fiwhat:
111-
Re with:
Jr
vJ]
v]
I()p!ions I
Jr
Mi-c
rocsoft Excel
OK
116
II
Help
Here's
Here's
10
ntJ
e
l======================
R
FQIV!Nt:
==
==
==
==
==
==
==
==
==
-------------
v
'
e:
---
ll
[
Close
01(
117
While the Formulas Tab, Define Name dialog is showing [Excel 2003:
lnsertiNameiDefine] you can't scroll unless the cursor is in the refers-to box.
Just thought you'd like to know!
118
_!__Idog
3
4
5
6
7
8
9
10 cat
dog
11
12 baby
lcat
3
4
5
6
7
8
9
10 cat
11 dog
12 baby
1
119
_:
l J,.::.
Ib::.:;
ab._
y_J
+f
4
5
6
7
8
9
10 cat
11
dog
12
baby
1 '1
The really neat part is that this is done without macros of any sort, just
formulas! Imagine having a parts inventory and being able to type in the part
number and get a picture!
Here's how it's done. The pictures need to already exist in the worksheet
and be equally spaced (and out of sight)-here's a 50% view of the work
sheet from cell U1:
Picture 6
A
1 baby
2
3
4
5
6
7
8
9
10 cat
dog
12 baby
11
13
_10
-1
,,
120
/:c =$U$1:$W$10
c
The dog starts in U 1 , the cat starts in U 1 1 , and the baby picture in U21.
That is, all the pictures here are 1 0 rows apart.
Next, you need a camera-tool type object whose reference is a defined
name, like =pic. See how to get the camera tool into the Quick Access
Toolbar in the tip about printing remote areas on the same page earlier in
this book.
Then, select a 1 0 row x 3 column set of cells near column U-like U 1 :W1 0,
then click the camera tool. Then click again near where you want the picture
to show up. In our example, that was around cell B2.You should see some
thing like this:
Picture 6
A
...
fx =$U$1:$W$10
c
baby
2
3
4
5
6
7
8
9
10 cat
11
12
dog
baby
13
,.
"
Notice the formula bar has a reference to the range originally selected when
clicking the camera tool. By the way: this works much better with grid lines
turned off, otherwise the grid lines are part of the picture.You also need to
format the picture to have no border:
121
Select the
the
g
albn
m Styles
Conditional format
atTab
.f:!
C:ll
St)'I<S
Jorma::A
t
C
el
l Size
P.o
![
S<t
lt& F':n
f: l!u - se r.
el9n;...
ute:F
Ro
w
He;
gt
CV:t'rJ .:.::_i-
..
Defa.;.z:t lidth...
Visibility
I
II
J
I
Benamt Sheet
or CopySheet...
!ab Color
Prot ection
I
I
J
I
I
I
>
Organize Sheets
-.-. . .-;
frolect Sheet...
)a
18
@]
F.ormat P.icture.,,-
o<k Cell
This shows:
>Y
...,.
__...
..
1'M'JF.o
" "
"
'
"
"
"u
v
=
.
.o.
!!..t?ID
and lines I
ffPropertiesn
I Pltture .
Colors
Size
Fill
clot:
J.ransp.vency:
IJle
<
I "';'
>
:2
["N'fL\9k'lld
Con_nector:
122
II
Web
Protection
,.
yle:
Weight:
lo%
cells
[dog
I
I
4
5
6
7
8
9
10
cat
11 dog
12 baby
One more example and we're done. If we type baby in A1 , then the MATCH
statement matches "baby" against pix and that part returns 3 since baby
is the third item in the range A6:A8. So 3*30-29 is 61: (90-29). So, "which"
is 61, and wh ich-1 is 60.That makes Pic be OFFSET(U 1 ,60,0,30,1 5), or the
range U61 :AI90. That exactly covers the picture of the baby, so the picture
switches!
This is involved, but the impact is great.
123
M33
LF
32
33
34
35
36
37
38
fxj{=O}
'
[Mj
.0
Pre
Pre
Protected range Protected range Pre
Protected range ,Protected ran$e Pre
..
Mi_;rooft xct
_n
r Oii-'1
'
ttt
!t!
d
"
"
stt
e
"
"
Notice that the protected range is out of sight and we're trying to insert a
row at row 37 which would put a blank into that remote range.
124
This
...
A
B
c
1 Number Tip
_?__I'-H---1! ere's some text
fie =MAX($A$1:A1)+1
0
5
3
10
11
6
7
8
12
. ..
You can see that the formula looks at all numbers from A1 (as an absolute reference) to the cell above (as a relative reference), and adds one to
the largest number on that range. I n this case, cell A4 has a formula which
examines A1 :A3 and takes the largest number (1) and adds 1 to it. So far no
big deal.This formula is not being filled down, but is copy/pasted to the first
line of each "paragraph." The nice feature with this formula, instead of simply
entering the numbers wanted, is that if you decide to delete a question or
add a new one, all the other numbers are re-numbered!
Let's see what happens when rows 6:8 are deleted, using the Delete Cells
command from the Cells section of the Home tab: [Excel 2003: EditjDe/ete]
d"" Insert
I:
Delete j:l
Qelete Cells...
Delete Sheet ,Bows
'JJ' Delete Sheet olumm
lim Delete heet
"'"
1
J
125
A6
A
1
1 Number Tlp
2
3
4
Br=
r
I =MAX($A$l:A5)+1
fx
C(
F.
7
8
4 Andyet another
Notice that cell A6 has the same formula as it did before, but what were
questions 4 and S are now 3 and 4! Suppose I wanted to insert a new ques
tion before question 4 (let's also assume there are 100 questions!)
First select rows 7:9 and use the Insert Cells from the Cells section of the
Home tab: [Excel 2003: lnsertiCe/ls)
I a""
;.a
.> .J
[31
I: ..
Insert (liS
Ia"" Insert
...
Now we have:
A7
A
1
txl
NumberTip
1 Here's some text
2
1-1-6 ----3Andanoeruestion--
7
8
9.
-------
10
11
12
13
126
I type in the new statement and copy/paste any of the formulas in column A
to cell AS:
AS
1 Number
Tip
fx
F.
3 And another
I:MAX($A$1:A7)+ 1
'
question
10
11
12
12 7
Suppose you have a list of names and addresses arranged like this and you
want to rearrange it like the textbox indicates:
1
Address
City...
2 Bob's Address
---<
Company
3 Judy's Address
Judy's Company
_L Laird's Address
12 Joan's Address
13 Reid's Address
14 LaVerne's Addre
15 Eli's Address
16 Oon's Address
17
en ::.
!
2J Bob's Address
1 Address
3 Judy's Address
4 Jane's Address
Peter's Company
Alice's Company
Joan's Company
\.on:y,-;:,"\.<ffe/L"lp
lcity...
Laird's Company
lp stefanie's Company
Herman's Company
Jared's Company
Judy's Company
Judy's Address
Judy's Oty, State Zip
etc
Jane's Company
Curtis's Company
11 Alice's Address
Bob's Company
4 Jane's Address
5
Reid's Company
LaVerne's Company
Eli's Company
Don's Company
D2:D4
(showing formulas):
c
Company
Bob's Company
Judy's Company
Jane's Company
Laird's Address
Laird's Company
Curtis's Company
.!
8
14
1
5
LaVerne's Addre!
l etc
Ell's Address
c.n::. "''lY1 .;)ld(, U'f.J
16 Oon's Address
128
lp Stefanie's Company
Peter's Company
Alice's Company
Jared's Company
Joan's Company
Reid's Company
p LaVerne's Company
Eli's Company
Don's Company
=C2
=A2
=B2
-+i
City...
Company
Bob's Address
Bob's Company
Bob's Company
Judy's Address
Judy's Company
Bob's Address
4 Jane's Address
Jane's Company
1 Address
3
_any
Herman's Address Herman's City, State, Zip Herman's Comp
6 Laird's Address
Curtis's Address
l;uoti'c: 6tirli'OC<
laird's Company
CUrtis's Company
l::rorl'c; rnmn::.nv
7in
which seems like a good start, filling this down (starting with selecting D2:
DS, including a blank cell) produces a disaster:
06
1 Address
Bob's Address
t.J=C6
l
City...
Company
Judy's Address
Jane's Address
Bob's Company
Judy's Company
Bob's Address
Jane's Company
Laird's Compan'!'
Curtis's Address
Curtis's Company
8 Jared's Address
Jared's Company
Bob's Company
!Laird's Company
La i rd'sAddress
Allee's Address
... .. -
. ..
Peter's Comp!ny
Alice's Company
Joan's copany
.... . .. ...
Peter's Company
Peter's Address
Peter's City, State, Zip
2 Bob's Company
D
=C2
3 Judy's Company
=A2
Jane's Company
=82
6 Laird's Company
=C6
5 Herman's Company
Curtis's Company
8 Jared's Company
9 Stefanie's Company
10 Peter's Company
A6
=
=86
=C10
11 Allee's Company
=A10
12 Joan's Company
. .. - . .. .
=B10
129
02
iAddress A
I xc2
City
Company
Bob's Address
Bob's City, State, Zip
Bob's Company
xa
Judy's Address
Judy's City, State, Zip
xa2
Judy's Company
4 Jane's Address
Jane's City, State, Zip
Jane's Company
xb2
5 Herman's Address Herman's City, State, Zip Herman's Company
6 Laird's Address
Laird's City, State, Zip
Laird's Compa ny
7 Curtis's Address
Curtis s Company
Curtis's City, State, Zip
...
'
8 Jared's Address
Jared's Company
10 Peter's Address
Peter s Compa ny
A lr.,....l,. ,..1 ,.
.
,..,.
"'tl-
'
",,_,_ ....---
..
Now, when you select 02:05 and double-click the fill handle, you get this:
A
Address
City
Company
Bob's Address
Judy's Address
Bob's Company
xc
2
Judy's Company
xa2
...
Jane's Address
Jane's Company
xb2
xc3
xa3
xb3
Peter's Company
Xc4
Alice's Company
xa 4
Joan's Company
Reid's Company
xb4
A
1
Address
City
Bob's Address
J udy's Address
Jane's Address
H er
Laird
CurtI
Ja re
9 Stet
10 Pete
...
Joan
13
Reid
14 1 "v..
130
xc2
xa2
xb2
rReQiace I
fi!ld wh&:
Riace woth:
[ Repice e,ll I [
B.epiace
I I
I
I [I Next I I Close I
[ Options
11 Aile
12
Company
Bob's Company
Judy's Company
Jane's Company
F!(ld All
Find
:.,...,.
':.:
d
::.
: d:,:
re
:.:
s
::=
s . .
'- City,:c
+ Co
:.:n
l,
:.: p;my
'-::c
-!
,---::--=
,---,..
..., .
.
= ,.,...
,
Bob's Ci
lob's Add
r
ess
udy's Address
S
t
ate, Z
i
p
Bob's Company
C2
Judy's Company
=A2
-- 1=B2
.
.
" L
.aird's
Find
:urtis's
FiQd what:
ared's
A..Piace with:
:tefani
'eter's
.lice's
oan's
R
ej!lace
"
'
'
'
'
==
==
==
==
==
==
=
=
===
==
==
==
====
===
=i=
;ijv
L ------------;===v
[ Opon
s
I
=C3
=A3
=B3
=C4
=A4
=B4
!;
;;
!!
-1
teid's
. a
Ve
rn
a-
AI
=C5
State,
Zip
Compa
ny:li's
Address
Eli's
City,
- Eli's
- =A5
=B5
>on's Address
Don's City, State, Zip
Don's Company
6
7
Address
City...
Company
Bob's Address
Bob's company
Bob's Company
Ju dy s Address
Judy's Company
Bob's Address
Jane's Company
'
Zip
-,-r
--
Laird's Address
Curtis's Address
8 Jared's Address
Laird's Company
Judy s Company
'
Curtis's Company
Judy's Address
J".
red's Co
pany
Peter's COmpany
Alice's Company
Jane's Company
' _
Jane s Address
Joan's company
Sneaky, eh?
But this was touted as mailing labels.The format is okay, but how can you
make these fit on address label paper? Well, you can tweak the row height of
the blank cells. First, you need to make column D be the print area, from the
top label to the last line of the bottom label. Check how it would look now,
using Print Preview. Make sure there are no labels which are split across
pages.You can also adjust the top & bottom margins. If it needs adjustment,
select column D, use FS(Goto), Special, select Blanks, and click OK. Now
only the blanks are selected. Now use Home Tab, Cells Group, Format com
mand, Row Height and make your adjustment, taller or smaller and print
preview again. [Excel 2003: FormatiRowiHeight]
131
possibly sortthese
by name?
I_
_
Il
I lI
T
I
It's already "arranged:' but what if you need to sort them by name? Not only
does this seem impossible, but the num ber of lines in each address is not the
same, making it more difficult! Or so it would seem!
First, we need to insert a row at the top:
A
'
2 Jones, Jim
3 addr1
Smith, Bill
1 possiblysort
by name?
7 Addr2
8 Addr2 part 2
10 emalladdr
132
f
I
I
r
I
these
"'I=IF(Al="",A2,Bl}
B
l
I c
!Jones, Jim I
B2
Jones, Jim
3 addrl
4
s
6
Smith, Bill
7 Addr2
8 Addr2part 2
10 emailaddr
11
The formula takes advantage of the blank between address-sets, hence the
need to insert a row. It says that if the row above is empty, use the name
(from A2), otherwise use the row above. Watch what happens when we fill
this down (important-include one extra blank row at the bottom to keep
the separation between addresses when we sort)
B2
"
__!__
Jones, Jim
3 addrl
4
S
..2_Smith, Bill
7 Addr2
_
8 Addr2 part 2
"'I =IF(Al="",A2,Bl}
Jones, Jim
Jones, Jim
Jones, Jim
Jones, Jim
Smith, Bill
Smith, Bill
Smith, Bill
Smith, Bill
11
Smith, Bill
.Johnson, Alice
Johnson, Alice
13 addr3
1 Clty3, state3 Zip3 Johnson, Alice
Johnson, Alice
1S emalll
12
Johnson, Alice
133
s
2 Jone
, Jim
:::J
---,
----Jones, JIm
addrl
Jones, Jim
-------
Jones, Jim
Smltl\. Bill
r'lpar12
c.o....
Smith, Bill
11
12 ohnson,
14
oladdr
..,,by
Smith, Bill
13 itddr3
J rK
s..t On
a...
.,.
:l.!
.,., :;;;:;
r
v, ::,;;
:...,.
.
vl "1::.::;;
.,,--,
.:;
Smith, Bill
Alice
--
Sorl
Smith, Bill
__
Johnson, Ahc
Johnson, AUc
15 emaill
email2
17 POBox
16
33333
Johnson, Aile
John$0n. Aile
'"' I I
Johnson, Aile
'....
..
. ''
resulting in:
B
A
1
2
Johnson, Alice
3 addr3
4
7
8
email1
Johnson, Alice
email2
Johnson, Alice
POBox 33333
Johnson, Alice
Johnson, Allee
12
13 Smith, Bill
1S
Addr2
Addr2 part2
Jones, Jim
Jones, Jim
Jones, Jim
Jones, Jim
Smith, Bill
Smith, Bill
Smith,
Bill
Smith, Bill
17 email addr
18
19 Zedwlck, Paul
Smith, Bill
20 addr4
Zedwick, Paul
134
Johnson, Alice
9 Jones, Jim
10 addr1
11 dtyl, Statel, Zipl
14
Johnson, Alice
Smith, Bill
Zedwlck, Paul
cance
!._[
'
=Sheet21$1:?J.048576
I
.. I
!I-'! I
fx '=Shee\2!$1:$1043576
A1
3 ,Sheet4 1 $1:
$ 048576
=She e
tS!$1: 1
$ 048576
=Shee
\6!$1:$1048576
=Shee
tl!$1:$1043576
=Shee
\8!$1:$1043576
=Shee
\9 ! $1 : $1043576
=She et!0!$1:$1043576
10 =Sheettl!$1:$1043576
1 =Shee\12!$1:$1043576
12 =Shee
t BI$1:$10435 76
- --
13 =Shee
4 !$1:$1
04357
6
\1
14 =Shee
\15!$1:$1
04357
6
fx ="=COUNTA( INDIRECT("""&MIO(Al,2,255)&"""))"
B1
A
II
1 heet2!$1:$1048576
heet3!$1:$1048576
=COUNTA(INOIRECT("Sheet3 !$1:$1048576"))
heet4!$1:$1048576
=COUNTA(INDIRECT("Sheet4!$1:$1048576"))
4 heets!$1:$1048576
=COUNTA(INDIRECT("Sheets!$1:$1048576"))
heet6!$1:$1048576
=COUNTA(INDIRECT("Sheet6!$1:$1048576"))
6 heet7!$1:$1048576
=COUNTA()NOIRECT("Sheet7!$1:$1048576"tJ
heetS!$1:$1048576
=COUNTA(INOIRECT("Sheet8!$1:$1048576"))
8 heet9!$1:$1048576
=COUNTA(INOIRECT("Sheet9!?1:$1048576"))
9 heetl0!$1:$1048576 =COUNTA(INDIRECT("Sheetl0!$1:$1048576"))
10 heetl1!$1:$1048576
-
=COUNTA(INDIRECT("Sheetll!$1:$1048576"})
11 heetl2!$1:$1048576 =COUNTA(INDIRECT("Sheetl2!$1:$1048576"))
. ...
-t"t-......ot
..
"\ tf"o1 .c'1 t\_.tH:"7C
1 ...
cA-1 , t'-1 n ..
nc-,cII'\
The formula in B1 is
="=COUNTA(INDI RECT("""&MI D(A 1 ,2,255)&"""))"
This is understood by Excel to simply be a bunch of text made to look like
a formula, but it does not act like one. Since it looks like the right one, let's
copy/paste special values (by the trick of dragging the border away & back to
the same spot which gives a dropdown to choose values):
135
I ="=COUNTA( INDIRECT("""&MIO(Al,2,255)&"""))"
B
=
COUNTA(INOIRECT("Sheet2!$1:$1048576"))
-----------------------+ --
-
=COUNTA(INOIRECT("Sheet3!$1:$1048576"))
=COUNTA(INOIRECT("Sheet4!$1:$1048576"))
Move Here
=COUNTA(INOIRECT("Sheets!$1:$1048576"))
.!;opy Here
=COUNTA(INOIRECT("Sheet7!$1:$1048576"))
=COUNTA(INOIRECT("Sheet9!$1:$1048576"))
1
ink Here
=COUNTA(INOIRECT("Sheetll!$1:$1048576"))
=COUNTA(INOIRECT("Sheet6!$1:$1048576"))
=COUNTA(INOIRECT("SheetS!$1:$1048576"))
=COUNTA(INOIRECT("Sheetl0!$1:$1048576"))
Create!jypeink Here
So now it looks like the formula we want, even in the formula bar:
Bl
fx =COUNTA(INOIRECT("Sheet2!$1:$10485.
1 =Sheetl!$1:$1048576
=COUNTA(INDIRECT("Sheetl!$1:$10485 71
2 =Sheet3!$1:$1048576
=COUNTA{INDIRECT("Sheet3!$1:$1048571
=Sheet4!$1:$1048576
=COUNTA(INDIRECT("Sheet4!$1:$1048571
=SheetS!$1:$1048576
=COUNTA{INDIRECT("SheetS!$1:$1048571
=Sheet6!$1:$1048576
=COUNTA(INDIRECT{"Sheet6!$1:$1048571
6 =Sheet7!$1:$1048576
=COUNTA(INDIRECT("Sheet7!$1:$104857
!ID-
(2
ot
=
=
rg
find
...
Replace
o To...
ac
btl
...
Go To Special...
Formylas
Comments
Conditional Formatting
Constants
Data Validation
136
Select Qbjects
Selection fane .
..
6
7
8
10
11
1?
fx =COUNTA(INDIRECT("Sheetl!$1:$1048576"))
A
=Sheet2!$1:$1048576
=Sheet3!$1:$1048576
=Sheet41$1:$1048576
=SheetS!$1:$1048576
=Sheet6!$1:$1048576
=Sheet7!$1:$1048576
=SheetS!$1:$1048576
=Sheet<J!$1:$1048576
=Sheet10!$1:$1048576
=Sheetll!$1:$1048576
=Sheet12!$1:$1048576
45
0
1
1
1
1
1
1
1
1
1
1
13 7
=!A1 :Z1 00
like shown:
,
.,.
..,..
N
ew
N
am
e
....
;._
'!:.
_,.
...
..
---'"""'
,
ope:
C:
aefers to:
lwort<book
ltAI:ZIOO
,..
-
OK
[
I
Canc el
then you can use this name to scroll the active cell to the top left of the
worksheet!
For example, suppose you have a worksheet which looks like this:
-t
, 0 .1
;,l
t<t:!
) d .J:;:!
1d.)UI
'CftiUI
.S -(u:.a
-dt
,...
,.
C1.J
.....
cf)1<1
4.1.1
on.-
1 4.1"...,
6J14
4.1t.1
C..1
d:
;.i IS>
.L
dat::
dt.lo
<Itit
chta
dJlA
(t,n;t
dJtf
.,.
d.t!lt
d..at
d.1Uo
1..l
clA!
dlol<l
doll..
.,,,.
.....
data
.,...
dt
d&tl
4.1t<1!
Cb!.l
...,.
d.){,\
u <!.tt..
c
t..a
b
l.S tl
16 Jt"'
"
dt.t
.....
.
d>t
cUI>
C'.Jt.1
.....
d
.)
I ,\
...,.
d1U
cs..:.a
....
.,.,.
dm
...
,
.
4-W.li
....
CI.U:t
d..lt
Itil
d.l !.-
d.!
...,.
.....
tht,\
...,.
"'"
.,...
d.i
d.at
4.la
.,.,.
11
-
"
t.l
"''"'
:..
......
""''
"
21
t:;tl
d>l>l
4.12
c!JtU
d.Jt..2
d...l
dJit.l1
chtll
&Ul
<1>1>
6>1.>
.....
....
d>U
....
'!
d.ttf
c:..-:2
ct
:.:.1
..
:..:
dld
-
:o.s
....
.,.,.
d.tt..1
-2l
dill
d4..
:z
4-f.-2
di!.
dt!.-t
;o
I
-
"'"'
cu
u I;!J
M
-
d ..
......
0
d)tla
dau
dt.li
c!Jll
(1..;11:1
'
Cll.l
.,.,,
u
; .,
d.ltil
d)!ll
.,.,.
"""
dUI
' .,.,.
.:0 CI;U
d!.\1
tJl
cla:.-2
1!1:
C..St-11
t\1:...1
.:.Jt-2
d.lW
.
e .t
..a
:
..
IC.lt.f)
d.1ta2
d.-t.l)
<l&U2
..w
d.-J
:.a
d;):.C
d.at.l.l
d.J:.u
"""'t
d>u>
cb.al
d.ii\#1
d.at
d
..
tt
1
CU
'::OIJ
dJu:
d.t
t.tl
4Jt-J
......,
d.-:#l.
"'
"'
d.l:42
t.:..,1
.....
.
dnll
d.1l.t7
4.1-.u
d.U.U'
d>t>l
and you'd like to see more of the data starting in cell 115. Certainly you can
scroll both horizontally and vertically, but you can also take advantage of this
newly defined name, z. Click on cell l15, then use FS and Goto z.The result
will be this:
138
115
fx
data2
data2
data2
data2
data2
data
15 data2
data2
16 data2
data2
data2
data2
data2
data2
data
17 data2
data2
data2
data2
data2
data2
data
18 data2
data2
data2
data2
data2
data2
data
data2
data2
data2
data2
data2
data
20 data2
data2
data2
data2
data2
data2
data
21 data2
data2
data2
data2
data2
data2
data
23 data2
data2
data2
data2
data2
data2
data
data2
data2
data2
data2
data2
data
24 data2
data2
data2
data2
data2
data2
data
25 data2
data2
data2
data2
data2
data2
data
26 data2
data2
data2
data2
data2
data2
data
27 data2
data2
data2
data2
data2
data2
data
28 data2
data2
data2
data2
data2
data2
data
'q rlt<>7
rlt')
rlt::t?
ri::lt::t'
ri ::l
t::l.,
19 data2
-
22 data2
rlt7
rlt<>
Notice that the cell has been scrolled to the top left. That's because, from
cell 115, the definition of z is =!I1 S:AH 1 1 4 as in this illustration:
tjew...
I[
t<ll.
I[
Veluo
Qelt<e
Refe.-s TO
fi l t e r ..
ComMent
- a relative reference to the active cell resized by 100 rows and 26 col
umns. In order for Excel to show as much as it can of this range, it scrolls
the worksheet!
Z is defined with a leading exclamation mark so that the sheet name is not
appended to the name, and you can use z to be a 1 00x26 shape in any sheet!
139
"'
=
l!J,I!fl_,tnc,ti!l=
Or sele<t a !;.ategory:
Select a functioo.:
IL_
An
_
_
_
_
_
_
_
_
_
MIRR
MMIULT
N(value)
Converts non-number value to a number,.- dates to.serrai numbers, TRUE to
I, anything else to 0 (zero).
, -'"',] VLOOK UP ( B22,x yztable, 3,FALSE)+ N(" T his will search the table for the zfactor")
- c l o l e
F ! G ' H :
: J 1
Io.otamJ
This formula now explains that the VLOOKUP is searching xyztable's third
column for the occurrence of cell B22's value for the z-factor (whatever
that is). The point being that the part of the formula, N ("This will search the
table for the z-factor") will be zero. not effecting the result. So you can use
the N-function inside formulas like this to document or comment on a part
of the formula by effectively adding 0.
140
,K_
.l
...,.
liN;
:ot.ak
"n.,.II.Oort
141
IAI
Illata
ITotals
.tllisRow
01
B I
data2 a
4
1
2
3
3
2
4
1,
1
2
3
4
5
'
fxlt=Table1(#Headers]}
0
loata
E
data2
Data
#All
#Data
#Headers
[Returns the total rows for the table or specified table columnsI
03
2
3
4
5
142
1
2
3
4
5
1
2
3,
,.
0
3!
3
4
5
6
7
11
12
13
14
15
16
17
18
A
Region
East
North
East
West
South
West
East
fx =SUMIFS(Amount,Region,''South",Oate,"<4/06")
8
Amount
Date
558 29May05
43 14-Apr-07
826 28-0ct-04
765 3Apr09
271 14-Feb-10
415 17-Jun-05
402 16-Mar-07
633 15-Nov-05
16 9-Aug-05
198 20-Jan-06
741 26-0ct-10
559
5-0eo-08
263 30-Apr-08
809 27NOV08
884 23-Aug-07
894 10-0ec-08
942 13Marll
East
West
East
East
North
South
West
North
1&51
11
508.4090909
481.2837838
22
Not Found
Not Found
ES
A
1 Region
East
North
fx =AVERAGEIFS(Amount,Region,"South",Oate,"<4/06")
Amount
Date
558 29-May-05
43 14-Apr-07
826 28-0ct-04
765 3-Apr-09
271 14-Feb-10
111&5
Isos.4o909o9!
The AVE RAGEIF function is like the AVERAG EIFS function, except there's
only one pair of criteria:
143
"' =AVERAGElF(Region,"East",Amount}
E7
Region
2 East
Amount
558
Date
29-May-05
4 East
826
28-0ct-04
6 South
765
3-Apr-09
West
508-4090909
1481-2837838!
415 17-Jun-05
F<l
ll185
271 14-Feb-10
Jlwest
R
43 14-Apr-07
3 North
s
40, 11\-Mr-07
The COUNTIFS fun ction is like the SUMIFS and AVERAGEIFS functions,
except the range to sum (or average) is not included. It's still pairs of criteria,
but they're merely counted:
E9
Region
Amount
East
14-Apr-07
11185
3-Apr-09
508.4090909
826 28-0ct-04
765
West
6 South
271 14-Feb-10
415
West
17-Jun-05
481.2837838
402 16-Mar-07
East
9 South
10 South
Date
43
4 East
558 29-May-05
North
5
"' =COUNTIFS(Region,"South",Date,"<A/06"}
16
221
633 15-Nov-05
9-Aue-05
You can calculate that 1 1 185 I 22 is 508.4090909, verifying that the SUM I
COUNT is the AVERAGE!
The last new function is the IFERROR function, which basically shortens
something like this:
I=tf(ISERROR(Vl0UP{
0K
"Herman",A2:CS0,2,FAISE)),"Not Found",VlOOKUP("Herman",A2:CS0,2,FAISE))
to this:
o l E 1
INotFound !
t 1 M
=IFERROR(VLOOKUP("Herman",A2:C50,2,FALSE},"Not Found"}
D
INot Found !
The syntax isjiFERROR(Val.;e,value_if_worJ which means that if it is NOT an error,
it returns the value of the calculation, as in the first longer example above.
In Engli sh it's "If the VLOOKUP returns an error, show "Not Found." Other
wise, do the VLOOKUP."
But this requires you to code the sameVLOOKUP formula twice in the
same function. The IFERROR avoids that!
,
144
Example:
Resulting Format:
General
2 decimals
Time format
1 2:00 PM
Date format
1 -Jan-00
C u rrency
$1.50
Percent
150%
Sc ientific
1.5
1.50
1 .50E+OO
145
146
14 7
148
2
3
4
5
6
I
I
149
Microsoft
Excel
_G
."..........".............1
'
OK
whereas ctrll[ would open the file, switch to the appropriate sheet, and
select the cell!
The FS (Goto) I Special dialog also has an "All levels" option button when
you select Precedents (or Dependents). This means that if, in the first exam
ple above, cell C3 had a formula which referenced H12, the all-levels option
would also select cell H 1 2 (in addition to B2:E4).
-
G.o To Special
C8J
Select
0 !:;_ome
m nts
0 Rodifferences
0 Eotmulas
0 erecedents
0 C2f'St4ntS
0 Column differences
0 Dependents
O D!redonly
0iAif!eveiSl.
---..--
0 Lat cell
Oaln
0 Current (B!jion
0 Conditional formats
0 Current rray
0 Data alidation
All
OoVects
.--
OK
Same
J [
Cancel
150
151
I c
H
F
I G
qT!J
!iO to:
E I
....
I_
vi
!l.eference:
191
I SPecial.
l It
OK
..
.
JI
Ca ncel
.
.
.
.
I.
.
l
then if you hold the Shift key down when you click the OK button, this will
be your result:
A
1
2
3
----1
6
7
11
10
In other words, the original active cell will still be the active cell.
If you shift click cell A2, now, the selection will be A2:C4, with C4 being the
active cell.
Since Ctrl/down arrow (or right/left/up arrow) takes you to the end of a
block, shift/ctrl/arrow will also take you to the end of the block, but the
active cell won't change!
152
Shift/F4 repeats the Find command after a find was done; Shift/Ctri/F4
repeats find backwards! That is, if you did a normal Find command to find
something:
IOpl;io,">S II
then if you close the find co mmand and use Shift/F4, it will still find the same
text, and Sh ift/Ctri/F4 will find the same text backwards.
153
'
154
Address
21
Name
State
City
Orlando
Fl
NV
Albany
TX
Houston
CA
San Diego
WA
Red
Fl
Zip
12345
12346
12347
12348
12349
12350
mond
Tallahassee
Use Home tab, Editing section, Sort & Filter, and Custom Sort [Excel 2003:
Data/Sort]:
: u
0..
X
inJ
Filt er Select
largest
ort Smallest to
Custom Sort...
Y=
filter
f:eppty
I.)!1Add
][X !!dote
lev el
Coi.Jmn
Sortby
,-
,__
_
_
_
-
J I-b Y
LOYd
II
level
,)
IQptions...I
0 MydatahastJoaclors
ar
d..
.. to z
.,
0 , ..sitiv.
Orie:nUaion
t
_.......,_,...,_,1
..
OK
II
Cancel
OK
cnce
a l
155
click OK,
--
Sort
'Row
SOrt by
SOr t On
IQptions.I
Order
then pick the row containing the desired column sequence (Row
case), and finally click OK:
A
IName 11
1
-
2
3
Address
0
3
City
E
4
State
5
Zip
Name1
Fl
12345
Name2
NV
12346
Name3
12347
Name4
12348
NameS
8 Name6
156
TX
CA
12349
12350
in this
A
1
=D$7
=$0$8
=C7
2 =$C8
: I
.--.:..:.
A
labc ! def
ghi
jkl
3
4
s
6
7
abc
def
ghi
jld
15 7
_j
Paste
'-cl
Clipboard r.
A1
jabc
1
-
ghi
11
Cahbri
I B I u I K .1
I
IEB I A
fldef
Font
.fx
r.
--.
jkl
Numbu Sl)
r.
Alignment
=C7
4
5
6
7
8
abc
ghl
10
Ready
def
]kl
27Sheet
37tl7
11Sheetl/Sheet
Num lock
lil41
l!m [Q]J!!!JLlOOj
(Notice both sheets 1 and 2 are selected, and there's another indication
you're in group mode-at the very top of the screen you can see "[Group]."
158
2. Select A1 :B2, use Across Worksheets in the Editing section of the Home
tab (this is dimmed when you're not in group edit mode) [Excel 2003: Edirl
Fill/Across Worksheets]:
Home
Sort &
Folter
Edotm
Find &
Select
tiJ
Down
11! BighE
IQI llP
),eft
cross Worksheets...
eries...
!usttfy
0:......
A
!.....IH
.
,
0 Contents
0 Formats
I[
OK
Cancel
[ I f
A
I =C7
fx
Al
3
This isn't Excel, it's Magic/
159
You can see in the formula bar that cell C2 still contains the reference to C7.
This is because the references don't change in a cut/paste, only in copy/paste.
7. Back to group edit (with Sheet2 active, ctrl/click Sheet1 ) select C2:D 3, use
Across Worksheets from the Editing section of the Home tab, [Excel 2003:
,
EditiFilljAcross Worksheets]
Down
[QI
.Bight
tm
Up
.!,eft
l!cross Workshee!s.,.=-o:
eries...
lutlfy
filling the 2nd sheet back to first. Shift/click Sheet1 and you'll see:
C2
A
rr!l
_abc
2 ghi
3
def
jkl
= C7
jl; c .li
def
abc
jkl
ghi
4
5
6
G.
jkl
ghi
def
abc
"o-1
C2
j:==
14 1 =C7
;..
15 2 =$C8
1
3
16
18
17 4
19
20
(
A
t.J =C7
-
=0$7
=$0$8
r
I
1:8
0
=0$7
=$0$8
I
[
abc
j gh
.::_
I
J. ::::.:.
ef ...
_Jijkl
_
_
_
_
160
ate
2 PA
3
f.<
8
JRegion
North
State
c
Amount
300
04
1
1
9
5
s
6
749
SOuth
700
348
508
935
582
10
11 WA
North
13
south
12
14
377
936
831
2
4
3
344
15
16 NY
North
18
South
97
120
17
577
955
19
83
A
1 State
2 PA
3
Region
North
South
J.<l
Am
oun
t
300
104
159
49
7
700
348
508
935
582
10
11 WA
North
377
13
south
831
12
14
16 N Y
North
18
south
17
243
344
5
1
19
936
97
120
577
955
161
Stat:
PA
3 PA
4 PA
s PA
6 PA
.c
1-
I=sz
.r.
s_] c
Region
North
l!::!orth
North
North
Amount
300
104
1S9
749
7 PA
SOUth
700
south
348
8 PA
9 PA
South
508
10 PA
South
93S
11 WA
South
582
North
3n
12 WA
North
936
13 WA
South
831
1 WA
4
South
2
43
15 WA
16 NY
17 NY
18 NY
19 NY
'"
south
344
North
97
North
120
South
577
South
95S
3. What? It can't be that easy! What happened? Look at cell B3: It says =B2,
or the cell above. Ctrl-enter says "fill the selected cells with the formula," so
every blank cell references the cell above. So A1 2 says =A 1 1 , etc.
Now the sort is trivial. And if you want to clear the formulas after the sort,
simply select 1 cell, use the FS key, click Special, select Formulas & OK, then
press the delete key to produce the sorted result.
==:
'
= A
1 State
2 NY
3
4
_,
5
6 PA
Reglon
h
Nort
Sout h
North
11
South
18
19
on
162
300
749
700
348
93S
14
17
sn
508
13
16
120
1S9
12
5 WA
1
97
104
8
10
Amount
955
c .J'--
5
82
North
3 17
936
south
831
243
344
IS
f:otnlulas
16 Ci
OntWtiOn
Sao
RnltW
Dt
,L..J1
"""' lfu"-1
a.ru
agt Sttup
P
Yi<W
..:1
&actoround Print
TUtl
'"
......
Orrtfopr
.....
., .
Wtdth: AUt
o
mc -
U
} Ht1ghl:
aJ Sal"
Gridlin.t:J
Vl.w
Automlti<
"""
'
1iudin9s
.J View
4Srif\0tofront AMon I
- !ljGroup
S.endt
Pnnt
SUi t to fll
t!:
'S h f.tt Op
"
tKtion Pane
Atrangt
o'tt
(by the way, if one object is selected, you can select all objects by ctrl/sh ift/
spacebar-if an object is not selected when you press ctrl/shift/spacebar,
you will first select the current region, and if you do it again, you will select
all cells): [Excel 2003:View1Too/bars1Drawing ToolbarlDraw menu ArrowlAiign or
Distribute]
Drawing Tools
1-Ins
t\
_r
tyles
Format
r,
Align !,eft
Align Right
oJ\}
Align Middle
.$.
Align enter
'iii
Align!op
wdl
Align ottom
D!}c
Distribute Horizontally
1:t
Distribute Vertically
Sna.2 to Grid
.S.nap to Shape
View Gridlines
163
For example, if you use Distribute Vertically on the left worksheet with the
objects selected... you'II see them as on the right:
c
t1 1.-.t:
!
J
tt
'i:
!
:
i
t
! Ol,
i
J
'
0 Option Button I
!
o
o
@Option Button I
0 Option Button 2
0Option Button 3
0Option Button 4
0 Option Button 5
164
165
CUBEMEM. . .
...
Book3
IF:ll
1
:X ./ fx =sum('*'!al)
=sum('*'!al}
2
-
fx UM(Sheet2:Sheet6!Al}
...
Al
Book3
-r
But there's another advantage to the shortcut. If you enter it in Sheet3, for
example, you'd see =SUM(Sheet1 :Sheet2!A1 ,Sheet4:Sheet6!A1 ) in the for
mula bar after entering =SUM ('*'!A1 )
.
Another variety of this tip is to use parts of sheet names. For example, if
your sheet tabs are named Sheet1, Bob1, Sheet2, MyBobDatabase, Bonbon,
Sheet3, Bonfire, and on sheet2 you enter the formula =SUM( *bo* !A1 ),
Excel will expand it to include all the sheets containing "bo" somewhere in
the name:
'
C5
Book3
1
2
.fx
'
=SUM('Bobl'!Al,MyBobDatabase:Bonbon!Al,Bonfire!Al)
3
4
5
166
ol
l1
2
3
A
want
these cells
4
5
6
7
to
8
9
all be
10
11
12
13 together.
1. Select
c
I. s
_,
I Go To Special
_
-
_! jwant
2
these cells
16
.
...
0Eormulas
to
8
9
10 all be
11
12
1 together.
14
15
Oconvnents
Seled
'Constants'
@X
---------
0Nvmbers
0Te;!lt
0Logicals
0rrors
Oelan
0 Current tegion
0 Current rray
0RO!! differences
0 Column differences
0 e_recedents
0 Qependents
D"ec
t or y
A l-eve.
Olacell
OoQ.lects
All
Same
OK
]j [
Ca
n
cel
16 7
3. Copy
'l
1 hwant
2
3 these cells
4
5
6
7 to
8
9
10
11
12
' 13
14
all
be
together.
. ._
.. -...,
- ---
I want
3 these cells:
------
'\6
:w=
I want
these
.cell
-
to
"""'-
all.;. be
;
-.,:.._....
- ,..
to2ether:
-------- '
7 -------:
8
9 - ----10 lall be
:
11
12 - 131_lto"ether.
:
;>
14
--
..
---
.. _
- - - ..
_ _ _ _ __
---
.-
i-----
j--
The results will always be constants, not formulas, even if they were origi
nally formulas.
168
In the following illustration, the grid lines were turned off, range A1 :C12 was
selected, the camera tool (See Print remote areas on same page, earlier in
the book). was clicked, and the picture was "developed" in range E1.
P icture 1
A
,_-
info
-+i info
1
-4
5
-6
7
8
9
10
11
12
info
info
info
info
info
Info
info
info
info
Info
..
-B
info
I =$A$1:$C$u
tx
c
info
info
Info
info
info
info
Info
Info
Info
Info
Info
Info
info
Info
Info
Info
Info
Info
Info
Info
info
info
info
info
Info
info
Info
info
info
111f 0
info
info
info
info
info
>.
"
info
info
info
info
info
info
info
info
info
info
info
info
no
info
info
info
info
info
info
Info
info
info
info
info
info
like this:
'-'
Info
info
info
info
Info
Info
info
info
info
Info
Info
info
Info
"'
info
info
info
Info
info
info
info
info
Info
info
info
info
i nfo
info
info
Info
info
info
info
info
Info
info
info
169
If you need to enter large numbers, like 1 billion, it's pretty easy to enter
the wrong number of zeroes. Instead of slowly typing the string of 9 zeroes
while mentally counting, you can simply type
Al
[l.OOE9
ltooooooo
Jnwt
Home
J(,
n
LJ
Pate
Clipbo a rd r.
Al
="'
Formulas
11
Jl
][Ell ][ &
e :....:
e
...:
A1 p- ...u l
.6. ]IC: !
rA
;;;:
Developer
View
Scientific
0/o
J[o8 +8]
t..l loooooo/
====r====r===;===
A- I F
G
H
8 J. c
1 I 1.00E+09l
--
Number
Font
R vi w
Data
----'-
Ollibrl
Page Layout
Al
110000000
f,c
_!_[looooooo!
__ --
--
E--
--
This isn't
171
89. Miscellaneous,
,.. X .J fx =sum(.A535:A525)
..
k! =SUM(A525:A535)
I
1
1 72
ol,
----!i-
1:1
A\
.. @@('l:) l l(i)J ---------------------1
P Starth
Excel
He l Md HOVtO
=-=
I
l tlelp
xce
se
llro
-w
--
;;j;'(sjj;;j
Getting help
tnsll!llin9
FR ccnversaon and tility
l'lorl:boolt
Accessi>ility
--------------------
-A\
1
P Starch
What's new
4items
@ 1'/hafs new In MicrosoftOffice E<cel 2007
@ Use d1e Ribbon
@
This isn't
173
Excel Help
;.:,
-+
IX) I"
P Sarch
'
- -..
---
1 74
--
. -.
-"'t=:;""=
t :-=. =:=
- -
2007
.:::.:
.":''"
.;:.-::e..-:-_
:..:: ::..-:..-
-
o;;;-:..o:::.::-:;-:n;;;-::!
-
!.(,)-AA------------------- til
1:1
----- -
Next
Jl-"1 J
Zoom
11812005
ny Cen.t:er Heade:r:
A
B
c
This contains page setup for
...
___ ._,..
And sheet2:
72
1/112003
63
2/112'003
70
17
"'
4/112003
./112003
81
104
S/1/200 3
98
112
7/112003
105
120
8/-t/200 3
112
128
3/1/2'003
sa
..
So, you can see that Sheet2 is portrait and has no left/center header, while
sheet1 has landscape, has an italicized center head er, a date for the left
header, and the data is shown with gridlines and row & column headings.
We'd like sheet2's settings to be the same as sheet1 's settings. Here's how
to do it:
1. Put both sheets in group edit (with Sheet1 active, ctrl/click Sheet2-you
can also shift/click, but if you're using sheets which aren't next to each other,
ctrl/click will only put the 2nd sheet in group mode, whereas shift/click will
put all the sheets in-between in group mode).
2. Use dialog arrow in the Page Setup section of the Page Layout Tab to bring
up the Page Setup dialog: [Excel
Pa);eLaovt
[JJ < !D
tYi:Qin( Orlati:Of{'
"
,.
'
. Dat
a
.e.J
F-1
...
.
.
Bteaks
.
'
R eV i eW'
Vftw
"
Ba.<.MJ round
.-
. .
. .
, ,.., . .. .
175
Page Setup
ra.J[;.Orientation
THeader/FooterTSheet-1
or>s
Scalonv
0 Ad to:
Oto:
!fg]
lt=
;lpage(s)wodeby .:.
1'_
---.=.J
:!tal
Iletter,
Quolty: -.M
Ied_ ,u
_ m_
Fi(.st pbQe number: [utoJ
Paper sile:
=<J
vI
8.5xll n.
Pt1nt
_______________
!rint...
I [Print
I [ Qptions
Previe<;!
OK
.
-
3. Click
OK
11 [
Cancel
4. Get out of group edit (shift click a sheet tab), or right-click a sheet tab and
select Ungroup Sheets
S.That's it. Really! Here's Sheet2 now:
You can do this with >1 sheet at a time, or even the entire workbook.To do
it for more than 1 sheet, simply put all the sheets in group mode and have
the sheet with the settings you want to copy be the active sheet. Then Page
setup/OK/get out of group mode!
1 76
To do the entire workbook, right-click a sheet tab, select "Select All Sheets,"
and repeat the process.
Jnsert...
Qelete
Bename
Move or Copy...
dJD
ewCode
Protect Sheet...
Iab Color
Hide
!:,!nhide...
=;(!)
mC
am
p
w
=
=
=
>
o
=
w
177
'
@liD
Goup [dit
Select !!roup:
[!'.9.k.!.ls.b..e.t.?.:_., _, . . .....
[Book!]Sheet3
[Book2)StieetI
[Book2)SheetZ
Booi,Z Sheet3
._[
'
... . .... .
K
0
.. ...... .
----'J1l [
'
, .. .
. .
Cancel
Selecting the sheets which contain the page setups to be copied, you can
then simply issue the File/Page Setup command as before. Once again, make
sure that the sheet with the proper Page Setup is the active sheet, because
selecting any other sheet will take you out of group mode.
And, once again, don't forget to get out of group edit mode!
178
cy
YlewCode
frotect Sheet...
Iab Color
>
t!ide
179
it
Access toolbar. C lick the Office button, then Excel Options: [Excel
2003:
ViewiToolbarsiCustomizeiCommands tabiTools from CategoriesiCamera (-213 the
way down) in Commands))
Re<en
t Do<umenb
t!<W
..,.
L../
Qpn
ltd
1V<
Save e,s
:bJ
Prepare
l For Oan.xls
-(:::1
-(:::1
i Webinar2.xl
-
t=l
PJ.lblish
-\'::1
Qui:.xls
z
Cool fml.xl.s
!!
l!
FlowChart.XI!
-(;:1
4-PivoU.xls
-!):l
Classm'atfs.xlf
6-P!VCALCS.XLS
-D=I "
Stn.sl
LJ
-t:l
i Movie Jeopardy3.xl
erlnt
1 oddityJ<ls
-!):!1
l065EOSO.xls
-1):;1
lFlLTER.XLS
-i):;J
-1):;1
3-Userl'orm.xls
-(;:1
Homtwork.xls
..j):a
Org.xls
-(;:1
Pivot1.xhx
-!:=
P4voU.xh
los
which brings up the following dialog.You will have to select the Customize
option, then select All
down, then scroll down until you see Camera (they're alphabetical):
Q'loo'(OI!Im<n(h froM:1
....
[All
Cunomiu .Quid:A-eufoolb.or::!J"
FQI (IQ(\IIIIffiU(011(.11
Comnu.tl(lt
--
II(W
U'J
Un<lo
('..t
A!do
Tr.ul Cen111
( tfllfl
CIUI\Ot Ql,ut 11)( ..
'"'"9" Colo"
Clung-tOt $ouru..,
180
This isn't
v
_.J
Swr
I
Qpcn
L.J
I
Areal
5 Anal
6 Neal
7
Areal
8 Arlil
' Art11
Areal
u Areal
12 Areal
10
Areal
Areal
Areal
Areal
Areal
Areal
Areal
Areal
Arell
Areal
Aftll
Areal
Areal
Areal
AJill
Arell
Ar1tal
Areal
Areal
Artll
Arul
Neal
Atell
Areal
Areal Aflll
Areal Areal
Areal Areal
Aletl Areal
Areal Areal
Antal Areal
Jueal Areal
Areal Areal
Areal Aftll
Areal Areal
Areal Attll
ArHl ...
,...
Areal iArea2
13
14
15
15
17
"Develop" the picture near the original range by clicking where you want
the picture to go.
Picture 2
'I A
1 Areal
I
I
/.-c =$M$11:$Q$16
Areal Areal
Areal
Areal Areal
9 Areal Areal
12
13
14
Areal
Areal
eal
Ar
Areal
Areal
18
Area2
Area2
1Q
If you hold the AIt key, the picture will exactly line up with the closest cell
grid.
For best results, you want to turn off the gridlines and removing the border
after the picture is shown. (Note the address in the formula bar).
181
Prlnt Area
A
I I
I
1 Areal Areal Areal
B
I Areal
I I
fx
Areal Areal
3
4
Areal
Areal
A real
Areal
14
15
Now select the cells to print, including the cells "behind" the picture and set
the print area, then print! It will print on one page instead of one page for
each remote area!
182
I ~ l]
ns Orientation
Size
Print
Area
El
I
Not nice!
.....
Breaks Bac.kground
-
C3L
I"= ~ &!]
Page Setup
fx
View
Review
Data
Formulas
Print
Titles
j:
;.
This isn't
183
[!;;\ l&l"l .
'
..
"-n v..w
0.,.... Ud-1
i;
icrosofl
14
filt
Edit
Jnsttt
mat
Areal
Ate
Anal
Are
3 Area1 Ate
4 Areal
Are
:;Goto
,.' u
Pr,...J
eo
--.
7 Areal
Areal Are
A1e11
Are
11 Areal Are
12 Ata:J2 Ar
13A<U2
.
..
....,
184
a1
::::::.
-.,...
,,.. -,
ao1L-.-
..,.
-,-..-:::.._
---
==
=
=;"'I- I
10 Ateat Ate
W)
'
,
,,__6,_,.
.It-t
Are
Sheet2 (S'Ie
5tle
Atet'l Ate
<
Oi' l
boo l;
&1. V8AProj.ect(8tnFaces.wla.
)
__,
___
.J ;;
'i
0 tion E x l icit
.\! V8Aho;cd(Book2)
e:JMierosdtfxttiOb:ie<b
@I SheetI (9leetl)
------
S Areal Are
6
Pt.RALXl.S{PCR SOf"fAL ;.
l.f6 KASOI'IAL.Xl.S (Pt:;RSClr'IA .:l
...,.
:::J 1..
- ==
" 6:--=-----====
m
L
" ==
F
H -!_
8
Q<Ouo
: !:l.dl)
! l!il iii . Q b
(Code))
End Sub
..
185
u.erform3
Notice the 2nd one has white handles. This one is the one used for aligning:
Add-Ins
Iools
lml
J:e:i
Ifi
ign
Size to Fit
.g,
Size to Grig
!,efts
t@
Centers
Help
:..
::: _:-
Rights
!ops
.IIJT
Horizontal SpacinQ
l!erbcal SpaCing
-o(} Middles
Jll&
ttoms
!:;enter in Form
:fll:
to rid
Arrange Buttons
!ifoup
b!ngroup
Order
'I
-
186
l:f>
Window
This becomes:
srform3
This isn't
187
luserform3 UserForm
Userform3
"
"
"
Alphbetlc CateQorlzed
. . . ...
. . . ....
. . . .
. . . . . .
. . .
..
'
. . .
'
. . . . .
. . ..
..
..
. .. . .
..
. .. ,
,_,
. '
"
188
. .
. .,
"'
.
,
_.
.
.
.
. . .
......
. . . . . . . . .
(None)
fmMcJUSeP'oint ll
....
&None)
0
. . . .
'
can save them! Select them both and drag directly onto the toolbox!
--
Toolbol<
Controls
{8)
. . . . . . .
abl IHll
P" r< j=!LJ....J
..!..l..:J;
.- ___;L.L.......,
rnl L...,,...-
. .
. . . . . . .. . . . . . . - .
.
. . . . . - . ... . . . . . - . .
- 0
. . . . . . . . . . . . . . .
. . . . . . .
&dditlonal Controls...
Delete New Group
erForm4
cI
. ..
. . . . .
A bl!!ril
...J
p r. ,...
CJ_j
d
,..
00
new Userform.
If you right-mouse click this new tool, you get
Controls
fi!.L-: ::-----L.L....:<<-'-;
zJ
rn
&dditional Controls...
e rro rm
erForm4
Ic
This isn't
189
and by selecting "Customize New Group," you will see these options:
--
Customize Control
Previewl
I iiD I
I
!.,oad Picture... I
dK Picture...
If"
Colors
1101
Ill
ll!l
ll
' I
Controls
C
t u:e l
l
e ar
]
abl
rv
r.
...J
r
...!..J
,.,
rn
OK
Ctll
LJ _J
.!lfcll
You can save any combinations for easy future development.And they're
available in all future sessions of Excel to drag out of the toolbox onto your
form. Only the design is kept, not any code behind the objects.
190
You can also place these on your own Controls "page"-if you right-click
New Page
Delete Page
Rename
...
Move
..
mport Page
...
Export Page
..
Controls
NewPage
Delete Page
Rename ...
ave...
!mport Page
!;_xport Page
..
UserForm3
which yields:
Rename
Caption:
OK
Cancel
191
or:
I I
I I
Controls
My Cool Controls
OK
And now you can see you can store a whole library of controls:
Controls
My Cool Controls
IOption ButtonsI
UsefForm3
'1Mnn11IP.<
I
just drag them from the control toolbox onto your userform!
192
'.JP
--
.
!!.:_t: k
r Done II
Wouldn't it be cool to show text simply by hovering (no click necessary) the
mouse over an object/ We'll show how you can have "Here's the explana
tion you wanted ... blah blah blah" when the cursor moves over the "Change
Aspect Ratio" button:
t1V
.J
---
r0o;;11
Here's the "magic" code to do that. First, the label has its "visible" property
set to False, so it doesn't show up when you first show the form. Here's the
code for the MouseMove event over the Change Aspect Ratio button:
Private Sub CommandButton2_MouseMove(ByVal Button As Integer, ByYal
Shift As Integer, ByVal
Me.Labei1.Visible =True
End Sub
The "meat" of this command is simply to make the label ("Label1") visible.
So whenever the mouse hovers over the button you see it. But you also
need to make the label invisible when the mouse is no longer hovering over
the button. There's no MouseNoLongerMove event! So, you need to place
another mouse move event over the form itself:
Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
Me.Labei1.Visible = False
End Sub
Now, when the mouse is over the form the label disappears, and when it's
over the button it shows up!
This isn't Excel, it's Magic!
193
-----
--
PCuros.;..-_,
-
,,
Mlteh
:O:tl
t
)'
)./'<
'
>
AI.I)H.
.ett bel
O<t
""'"'
IL
Jl
e+:
9J!Lons.
;;,;- r@
Color
Save
Sewrity
Error Checb-.g
Generat
Transition
Chart
List tnboes:
,
Fet.tu..tarct,
,;.pr
l't
Ju;
e
JUly
"'
f
I
Ad;;
o:e
tu'1JSt
Ste-.bet
-
If you want to show days of the week, you'd use Application .GetCustomlist
Contents(2)!
194
"6
. r-========
Parer Info
Ctti+SNft+l
Ctri+Space
0 &H800()()()0j
;r.xuilQM..,;,
A. e'mtr-(;o."'"'
Cit:!I A Soc.:..r1u1r.$
Done
Privatc Sub Co
andButton2_MouseMove(ByVal Buti
A1.11isible : Truc
Me.Labell.Visible : False
As:
End Sub
You can mark code even across projects, and as you click the Next or Previ
ous Bookmark button, it will immediately take you to that section of code.
You can even bookmark the immediate window(!), but you won't see the
indicator because the immediate window has no margin. But you'll see the
cursor blinking in the immediate window!
This isn't
195
Sub AccessRowsO
For i = 0 To 6
j = ArTay(4.
RowsG).Font.Bold
1\lext
End Sub
The statement Array(4, 1 3 , 19,20,28,44,123) has 7 elements in
bered 0 through
it,
num
Sub AccessRowsO
For i = 4 To
123
Select Cose i
Cose 4,
Rows(i).Font.Bold =True
End Select
Next
End Sub
196
Here's a simple technique to ensure they allow your macros to run. Save the
workbook with only one sheet showing, and that sheet may look like this:
....
81
Protect
Prote ct
Sheet Workbook
Restrict Editing
Protect Structure and Windows
I
Restrict Permission
Jj
Unrestricted Access
,Bestricted Access
Manage Credentials
0 S,tructure
On
i dows
eassword (optional):
OK
J] [
Cancel
19 7
lworkhook
Pl'ivote Sub Workbook_OpenQ
ThisWorkbook.Unprotect "abc"
For i : 2 To Sheets.Count
Sheets{i).Visible: True
1\lext
Sheets{l).Visible: False
End Sub
Private Sub Workbook_Befol'eCiose{Concel As Boolean)
Sheets{l).Visible: True
For i: 2 To Sheets.Count
Sheets(i).Visible: False
Next
ThisWorkbook.Protect "abc" shuctute::True
'
End Sub
Notice also that before the workbook is closed, it also resets the sheets
back for the next time, hiding all sheets except the message sheet. It's turned
to visible first because you can't hide all the sheets in a workbook!
Lastly, you can protect access to the VBA code by using this in the VBE:
ebug
B,un
IJ
Iools
0
,.. &:1
IT [workb
Pri
I Add-Ins
Help
, Cc
B,eferences...
ltronal Controls...
<i=:. ,
I==
Macros...
1-
Qptions...
Digital Signature...
..-.
.
198
Window
In(
n11n
.
"<
And then:
!P.!. i!;.L:J>
.!i !:,<;1J'J:2 P Qi_e--*
General Proteclion I
.;.
.....-
Lock project
Lock ptO)eCt for VIewing
I
Password to view project properties--------,
Password
Confirm password
"'I '"'"
,
...,.
OK
I
'
H
elp
.
'
So now, if the user opens the workbook with the shift key down, it's a fairly
useless workbook!
199
it
wasn't found! So re
I '=Sheet2!A1
I D I
fx
c
The way to remove them is via text-to-columns! Use this feature on the
Review
;., Clear
Reapply
.":V Advanced
Iter
View
Developer
1:=-.:I
Text to
Remove
DatalText to Columns]:
Add-Ins
=
-
--=
Columns Duplicates
11 Data Validation
o Consolidate
What-If Analy i
Data Tools
When you get the Text to Columns wizard, just click Finish!
200
s s
Did you ever have an odd selection and wanted to have the same selection
814
1
2
3
4
5
6
123
123
123
123
123
123
123
8
9
11
12
13
14
-
123
123
123
123
123
10
--
1123
/x
123
1231
Now you want the same shape beginning in D 1 . The easiest way to do it is
using the VBE's immediate window to execute a simple one-liner command:
Immediate
selection.offset(O,3).select
This isn't
201
The result:
A
123
123
123
123
123
10
123
11
123
12
123
13
123
.
l
123
I
I
123
otJ-=-t]F
123
15
202
123
123
r
i
l
I
.,
Sub BoolcanTestQ
If Range("A12").Voluc
MyBool
True
False
>
12 Then
Else
MyBool
End If
End Sub
Sub BooleanTestO
MyBool : (Range("A12").Vo.lue
>
12)
End Sub
The expression (Range(''A 12").Value
>
er than 1 2, My BooI will be set to True, else it will be set to False, the same as
in the first example! Quite a bit sh orter!
203
Suppose you need to fill cells A 1 :D1 (using VBA) so it looks like this:
B
c
A
___::l_:.N:.:;a;.;.;m;.;.;e;..._.Aceount # Date
2
D
Amount
Sub FiiiRangeQ
Range("A1").Value ="Name"
"Date"
Range("D1").Value ="Amount"
End Sub
...and that would work fine. But look at this version:
be
What if you wanted to fill A1 :A4 with the same information? You might now
be inclined to use this:
Sub FiiiRongeQ
Range{" At: Dl").Value : Array("Narne", "Account #", "Date", "Amount")
End Sub
204
B=...=2c=o:
1_:::
Name-r
1Name
jName
-11Name
2
3
<--F
.
" I
...not what you expect.You need to use this code to accomplish the vertical
arrangement of the data:
Sub FiiiRangoQ
Range(" A1:A4").Value : Appl ieation.Trar<po<e(Arroy("Norne", "Account #", "Dote", "Amount"))
End Sub
That is, you need to transpose the information. Since Transpose is a work
sheet function, you need to use any of these combinations:
Appl ication.Transpose
Appl ication. WorksheetFunction.Transpose
Wor ksheet Fu11ction.Transpose
The latter two will give the intellisense dropdown:
Wo r kshet Function
:.. ---
-----
""!Acos
....... ........:a,
:-----
- -
.:.
Acosh
"" And
..
J Application
,, Asc
'" Asin
"' Asinh
The reason
I chose the first one (without the intellisense) is that it's the
205
it, then
It,
vi
sa
- Savesening
r!t savStringForHoldingTheDescr1ptlon
"' Second
Seek
rf!JJ Selection
'" SendKeys
... and you can use the down arrow to select it, then the tab key (or enter
key) to put in into your code:
sav
< SavePicture
,, SaveSetting
rtf}
" Second
" SeeK
rtf} Selection
.: SencJKeys
If what you typed is unique enough so there's really n o choice (like if you
typed savs then pressed ctrl/spacebar), Excel will simply put the entire vari
able right into the module.
As a matter of fact, it's not just for variables. How often do you type out Ap
plication? Simply typing Appl and pressing ctrl/spacebar will put Application
right in the code!
206
oppl
l!ii' ApplicatiOn
., Asc
.o AscB
...AscW
r5J Assistant
"- Aln
And, if you have nothing on the line and press ctrl/spacebar, you will still get
the beginning of the list:
:.-..;Ails..
..
..
..
..
..
---....- --
..
.
.
- ..
..
.
.
.
....-..
---
.
-
---
..
..
-----M--------- ..
..
- ...
AcliVeCell
ActiveChart
ll1ii' AcbvePrinter
ActiveSheet
AcliveWlndow
ActiveWorkbook
_
_
_ .,
_ ,1 _
_
,
_ __
___
.. _
__
_
,
,
20 7
savStrI
.
End Sub
.-
'' I I
d. CUt
q_ Copy
!h. P.aste
..!.
ti].
;J
U;t Properties/Metb.o.ds
.
Parameter'lnfo
J,
Complete ord
'T'
I
."
Lit Constants
'
Quick Info
lOJQie
....
Add Watch...
Qefinition
Last Position
!:!ide
208
ption
3D formulas, 1 6 6
Aligning 0 bjects, 163
Apostrophe
Bulk removal, 200
Apply Names, lli
Autosum
Enter from keyboard, 148
Auto-Sum
Features,
Fill down
Fill Handle
Insert/Delete rows, 22
Borders
Shortcut, 146
#VALU E,70
Camera Tool
Comments, li
Oddity, 169
Characters
All in Font, 110.
Closing workbooks,
Comment
Inside formula, 140
Comments, Formatting, 6A
Copy formulas
Cursor Movement
Remaining Stationary, 165
Fill, Z5.
I ndenting, l.A
Long, !U.
Cut, Copy
Named,
Via Borders, 21
Data entry
quicker, 1 7 1
Shortcut, 147
Dates
As range. 2B.
REPT.1 02
Show picture, 11i
SUMPRODUCT,1 05
TEXT, 1QZ
Functions
New to 2007, 143
209
List
Lookup
More than
1 value, 1Q.Q
REPT.1 02
Ribbon (Hiding), 1 7 3
Right-Mouse
Border.
Mailing labels
Trick1 , 128
Trick2.132
MATCH Formula,lQB.
Merged Cells
Row Height, S1
Multiple selection
Selecting offset, 201
Scrolling,
Drag, 56.
Selection
All Specific Text, 1.6.
Anchoring active cell, 1 5 2
Bring into view, 149
Select successive corners, 1 5 1
Names
Creating, U
Shift key
While opening workbook, 197
Shift-Click, 4i
Defining Large
Shortcut
areas, 2..2.
Global vs Local, .2.0.
3D formula, 1 6 6
Long. !d.
Autosum, 148
Borders. 146
Self-D efining. l0
1
X
LM,92
Page Breaks
Date
Formatting, 145
Miscellaneous, 154
Select Precedents, 1 5 0
So rting
Columns, 1 5 5
Space character
Intersection, 103
Split screens (In VBA, too), 18.
SUM PRODUCT,105
Table
New features, 1 4 1
TEXT, 1QI
Tools
Double-clicking, ll
Unique
Entries, 3B.
Values, .2..5.
Userform
Invisible objects, 1 9 3
Get to routine 1 84
Shortcuts, Part
Using pictures, 188
Visual Basic
Arrays, 196
Boolean test, 203
2,2
0
8
Title, 1
,2
, 11.
211
ISBN-1 0: 0-9792153-2-3
ISBN-13: 978-0-9792153-2-2
5 1 4