You are on page 1of 362

1

Excel

www.ExcelExpertTraining.com
www.XLSiam.com
excel@XLsiam.com
02 718 9331 Fax 02 318 7021


17 2555

Copyrightofwww.ExcelExpertTraining.com

1.
Excel

2.

3.

17

4.

21

5.

23

6.

25

7.


26

8.

41


9.

44


Excel
10.

54

11.

66

12.

71

13.

78

14.

79

15. Goal Seek

80

Copyrightofwww.ExcelExpertTraining.com

16. Data Table

85

17. IF

90


18. IF

95

19.
IF

104

20.
IF Format

114

21. Data Validation

115

22. Conditional Formatting

116

23. Array

118

24. Array IF

130

Excel
25.

143

26.

147

27. Format Cells > Number

151

28. Add-In

155

29. Function VBA

157

30. General Functions

202

31. Day and Time Formulas

224

Copyrightofwww.ExcelExpertTraining.com

32. List & Database Formulas

246

33. Conditional Formatting & Data Validation Formulas

248

34. Array Formulas

253

35.

281

36.

297

37.

304

38.

312

39.
...

315

40.

325

Copyrightofwww.ExcelExpertTraining.com

Excel


Excel

Excel


Excel




Excel 2010

Excel

Excel Excel





Excel Excel Access
Excel

VBA




17 2555

Copyrightofwww.ExcelExpertTraining.com

Excel


1. Enter



File > Options > Advanced >
After pressing Enter,

Move selection
Excel 2007 Office >
Excel Options File >
Options >
Move selection after Enter)
(Excel 2003 : Tools > Options > Edit >
2. F2
Edit Formula Bar File >
Options > Advanced >
Allow editing directly in

cells
(Excel 2003 : Tools > Options
Edit directly
> Edit >
in cell)



Excel



F5 > Enter

Copyrightofwww.ExcelExpertTraining.com

3.
manual File > Options > Formulas >
Manual

F9
Shift+F9

Manual)
(Excel 2003 : Tools > Options > Calculation >



4. Macro Update Links

File > Options > Trust Center > Trust Center

Settings... (Excel 2003 : Tools > Macro > Security > Security Level >
Medium)


Trusted Locations
Add new location...

Copyrightofwww.ExcelExpertTraining.com

(Trusted Folder)

Excel 2010 Trusted Documents



Macro Update Links

Copyrightofwww.ExcelExpertTraining.com



Excel

(Cell Reference) Excel






$
$
, $ Conditional Format, $
Data Validation, $

Excel $
Excel

Excel





Excel


Excel




)


(

Excel





Excel


1.







Copyrightofwww.ExcelExpertTraining.com

10

2.












3.


4.



5.

(Smart Formula)

Smart Formula






Copy Paste





$
3

Absolute Reference
$
=$A$1
Row Column


Relative Reference


=A1
$


Copy Paste


Conditional Formatting Data Validation

Mixed Reference



$ Row Column
=A$1

Row 1 =$A1
Copyrightofwww.ExcelExpertTraining.com

11

Column A Copy Paste



$ Row Column
Pointing F4
$
1.

=
(



Enter)

2.


(Pointing ) Mouse

A1



=A1
3.
F4

$


F4 A1 $A$1 A$1 $A1 A1
$

4.
$ Row Column
Enter
Excel

Copy






$ (
$

Replace
$
Replace with
)


$

Smart Formula IF, And, Or


Copyrightofwww.ExcelExpertTraining.com

12


Smart Formula


1.
C3
=
2.
C2 =C2
3. F4

=C$2
4.
*
5.
B3 =C$2*B3
6. F4

=C$2*$B3
7. Enter
C3
8. Copy C3:F5

C3


Smart Formula



Smart Formula


2 10

=C$2*$B3
10 2
=$B3*C$2






Index Offset


Excel

Copyrightofwww.ExcelExpertTraining.com

13

Row
Column

C$2
$ 2

Row 2


C
$

C
Column D E F Column

$B3
$ Column B

Column B
3
$



3
Row 4 5 6 Row



$
$ Row ( = Row)
$ Column ( = Column)



Smart Formula



C2 B3

C2:F2 B3:B5
F4

=$C$2:$F$2*$B$3:$B$5
1.
C3
=
2.
2 - 5 =C2:F2
Copyrightofwww.ExcelExpertTraining.com

14

3. F4

=$C$2:$F$2
4.
*

5.

10 - 30
=$C$2:$F$2*B3:B5
6. F4

=$C$2:$F$2*$B$3:$B$5
7. Enter
C3
8. Copy C3:F5


$

Row Column


=$C$2:$F$2*$B$3:$B$5




$

Copy

(

)



$
Absolute C3:F5

Copy
Error

Copyrightofwww.ExcelExpertTraining.com

15

Array
Smart Formula


1.
C3

C3:F5

2.

=
3. C2:F2 =C2:F2
4.
*
5. B3:B5 =C2:F2*B3:B5
6.

Enter Ctrl+Shift+Enter 3

{=C2:F2*B3:B5}



C3:F5 C3

Array

Formula Bar C2:F2


Mouse
F9
{2,3,4,5}
Esc

Copyrightofwww.ExcelExpertTraining.com

16

Formula Bar B3:B5


Mouse
F9
{10;20;30}
Esc

F2 F9 Array Formula Bar {=


C2:F2*B3:B5}
={20,30,40,50;40,60,80,100;60,90,120,150}

Comma Semi-Colon
(

Comma ,
Row

Semi-Colon ;
Row )

={20,30,40,50;40,60,80,100;60,90,120,150} Array


4 Column 3 Row


C3:F5

Array


Array Array


C3:F5

Array
Excel



( Copy Paste

Array


Array
F5 >
Current array
Special >

Excel


Array



Array


Copyrightofwww.ExcelExpertTraining.com

17















127



13.45%



100
127 10% 13.45%




Excel




Excel


Excel


Excel Help Excel

(

Excel Help
)

Copyrightofwww.ExcelExpertTraining.com

18




Formulas > Insert Functioon


fx
Forrmula Bar






se
A
All
elect a category
Select

S
a fun
nction


Excel




Help on
n this funcction


See Also

Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

19


=



Ctrl+a
C

Help

Function Scre
een Tips


column
c
Show
column
w Function ScreenTipps
File
Form
> Optio
ons > Advanced ( Filee > Option
ns > Formu
ulas >

mula

AutoCo
omplete

Excel

Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

20

Excel Heelp

Remark
ks

Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

21


Material Requirements Planning

=INDEX(Begin,COUNTIF(Cum_Hour,"<"&(I10+((INDEX(Cum_Hour,MATCH(VLOOKU
P(J10,Begin,1),Begin,1),1)-INDEX(Working_Hour,MATCH(VLOOKUP(J10,Begin,1)
,Begin,1),1))+((J10-VLOOKUP(J10,Begin,1))*24))))+1,1)+(((I10+((INDEX(
Cum_Hour,MATCH(VLOOKUP(J10,Begin,1),Begin,1),1)-INDEX(Working_Hour,MATCH
(VLOOKUP(J10,Begin,1),Begin,1),1))+((J10 - VLOOKUP(J10, Begin, 1))*24)))(INDEX(Cum_Hour,(COUNTIF(Cum_Hour,"<"&(I10+((INDEX (Cum_Hour,MATCH(
VLOOKUP(J10,Begin,1),Begin,1),1)-INDEX(Working_Hour,MATCH( VLOOKUP(J10,
Begin,1),Begin,1),1))+((J10-VLOOKUP(J10,Begin,1))*24))))+1),1)-INDEX(
Working_Hour,(COUNTIF(Cum_Hour,"<"&(I10+((INDEX(Cum_Hour,MATCH(VLOOK
UP(J10,Begin,1),Begin,1),1)-INDEX(Working_Hour,MATCH(VLOOKUP(
J10,Begin,1),Begin,1),1))+((J10-VLOOKUP(J10,Begin,1))*24))))+1),1)))/24)

F2 formula bar Excel











2







Formula


Bar F9 Esc


double
Excel

Allow editing directly in Cells


File > Options > Advanced


F5 Enter






Alt+Enter






Enter Excel

Copyrightofwww.ExcelExpertTraining.com

22

Commen
nt

Insert Co
omment





Forrmula

Name
Form
mulas > Na
ame
Manager








Row Difference
F5 > Special
S
>
es
Column
n Differencces
Precede
ents /
Depend
dents Direcct only


OK
O
F4
4

Ex
xcel



Formullas > Form
mula Auditin
ng > Trace
e Preceden
nts/Dependdents


Formula

as > Formu
ula Auditing >
Show Formulas
F




File >
R1C1
Options > Formu
ulas >
referen
nce style

Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

23



file

sheet



1.
2.
3.












=MATCH( MinimumCost, TotalCost, 0)



Match
=INDEX( LotSize, MATCH( MinimumCost, TotalCost, 0), 1)

IF


0 - 50



C 51 - 80 B 80 A A

Copyrightofwww.ExcelExpertTraining.com

24

=IF(>80,"A","BC")
B C IF

=IF(>80,"A",IF(>50,"B","C"))

copy paste
A1: =NOW()
A2: =DAY(A1)

copy NOW() A1 A1 A2

=DAY(NOW())

copy
Formula Bar
NOW() copy ( Ctrl+c) Esc

A1 Formula Bar A2 paste
( Ctrl+v)

Copyrightofwww.ExcelExpertTraining.com

25

Formulas > Define Name






Calc1 =VLOOKUP(RelativeStart, Begin, 1)


Calc2 =INDEX(Working_Hour, MATCH( Calc1, Begin, 1 ), 1 )
Calc3 =INDEX(Cum_Hour, MATCH( Calc1, Begin, 1 ), 1 )
Calc4 =Calc3 - Calc2
Calc5 =RelativeStart - Calc1
Calc6 =Calc4 + ( Calc5*24 )
Calc7 =RelativeHour + Calc6
Calc8 =COUNTIF(Cum_Hour, "<" & Calc7 ) + 1
Calc9 =INDEX(Working_Hour, Calc8, 1)
Calc10 =INDEX(Cum_Hour, Calc8, 1)
Calc11 =Calc10 - Calc9
Calc12 =(Calc7 - Calc11) / 24
Calc13 =INDEX(Begin, Calc8, 1)
Calc14 =Calc13 + Calc12


F3





Define Name
Copy

Calc14

Calc1 Calc13

Copyrightofwww.ExcelExpertTraining.com

26





Microsoft Excel





(

)



Excel
Excel











Excel



Excel
Excel

Excel

Sum, If, And, Or, Choose,


VLookup, Match, Index, CountIF, SumIF, Offset, Indirect, Array Formula

Excel


1.
Excel F1

Excel Help
Excel




Help (
Help )


Excel
2.

( Excel

Copyrightofwww.ExcelExpertTraining.com

27


Excel


)
Excel

www.xlfdic.com
3.

Excel 150 download
4. Excel


5. Excel











6.


Excel

=2*3 =123*4.56
7.







8.






9.

10.



Google

10
Excel



Excel 2007


Excel







Excel



Copyrightofwww.ExcelExpertTraining.com

28

Formula vs Function

Formula

Function

=A1
Formula

=
=1+2 =Now()

Sum, Max,
Function

Excel
Min, If, VLookup Now



Formula

=
Function

Sum VLookup



Excel


Text vs Number



3

Text


Number error


Text


abc
( Format)
123 Format Number



Text Text
Text


Number


123
( Format)
14/2/2009

Excel

####### (
Shrink to fit
Format Cells > Alignment >
Excel
Font
)

Error
Copyrightofwww.ExcelExpertTraining.com

29

o #N/A

(Not Available)

=answer
o #NAME?

Range Name answer



=A:A B:B
o #NULL!



=Sqrt(-1)
o #NUM!

o #REF!
delete
=123*a
o #VALUE!


Excel



vs


1, 111, 123
1. Number
a, aaa, abc
2. Text
=1, =111, =123
3.

Number
=a, =aaa, =abc
4.

Text







1
111 123 1
=1
=111 =123
=1




1
1, 2, 3, 4, 5




Copy Paste Special Value




Error
IF Error

Copyrightofwww.ExcelExpertTraining.com

30

A1 Number =IF( IsError(A1), 0, A1)

A1 Text =IF( IsError(A1), , A1)

=IF( IsError(A1), 0, A1) Number


Text Format 0






Insert Row Column

B2:D5

Column B
D Row 2 5


Copyrightofwww.ExcelExpertTraining.com

31

Column B D Row 2 5




Excel =IF(C2=0, 0, B2/C2)



Error
#DIV/0!

C2 0 0 C2
0
C2 B2





=if(c2=0,0,b2/c2) Enter

=if c2=0


Excel


Comma


Enter Excel

Copyrightofwww.ExcelExpertTraining.com

32

Excel Excel











=IF(C2=0, 0, B2/C2)








1.

2. if(
3.



C2
4.
5. =0,
6.

7. =if(C2=0, 0
8. 0,
9.

10.

0, 0

B2
11.
12.
/
C2
13.
14.

15. B2/C2 0

16.
Enter

Excel








Copyrightofwww.ExcelExpertTraining.com

33

=if(.........C2=0,.........0,......... B2/C2




Comma



Excel



IF, MAX, MIN
1.


Excel
Enter


2.


Enter Excel


Enter Excel


3.

4. Excel

(



) 7
5. Excel





IF
Excel =IF( , ,

)


Excel

www.excelexperttraining.com/blogs/archives/z300-ExcelCore000706.php
6.
Index Offset
(





)

Copyrightofwww.ExcelExpertTraining.com

34




7. (Option)

VLookup Match
1
7.1. Option


( )
0
7.2. Option False

( 0 )
7.3. Option -1


( )


=1+2-3*4/5^6 Excel
1.
^ 5^6

2.

3*4 5^6

3.

1+2 3*4/5^6


(
Excel 2003
Excel 2007

Excel
)



7 Argument

comma 30 Arguments ( Comma 29

30 )





1,024

Copyrightofwww.ExcelExpertTraining.com

35

Excel
2007

1.
64 (Nested levels of
functions)
2. 255 arguments (Arguments in
Functions)
3.

8,192 characters (Length of formula contents)

Microsoft





""





Excel




=A1
A1


A1
=A1
Allow edit directly in cells ( Excel Options

> Advanced Excel 2003


Tools > Options > Edit)


=A1 cursor A1
Copyrightofwww.ExcelExpertTraining.com

36



ExcelExpertTraining.com




"

"




=INDEX(A1:B10,5,2) A1:B10

Row 5 Column 2 B5
B5
Row 5 Column 2
=INDEX(A1:B10,5,2)

Formula Bar

F5 Enter =INDEX(A1:B10,5,2)
=B5


Esc


Copy =INDEX($A$1:$B$10,5,2) F5 Ctrl+v
Reference Enter Excel

Paste

B5 (

Absolute
$A$1:$B$10 )

Offset




INDEX(A1:B10,5,2)
Offset
INDEX(A1:B10,5,2)

=OFFSET(INDEX(A1:B10,5,2),2,3)

E7 E7


B5
2 row 3 column
=OFFSET(B5,2,3)
=INDEX(A1:B10,5,2) D12 Offset D12
=OFFSET(D12,2,3) D12 Offset
B5
Index D12

Copyrightofwww.ExcelExpertTraining.com

37


If,
Choose, Index, Offset, Indirect ( VLookup )




"www.excelexperttraining.com/forums/content.php?r=191-- "


Excel



Excel

Array

















Array




A1:A3 11,
22, 33

Copyrightofwww.ExcelExpertTraining.com

38

=A1:A3 B1 11


F2 F9 =A1:A3

={11;22;33}

{




Array
semi-colon ;

Row (
Row )

3
Esc

=A1:A3


Array

3 ( 3

)

=A1:A3
Ctrl+Shift+Enter Excel

{=A1:A3}
{

Ctrl+Shift+Enter
(


)





F2 F9


Excel

error #VALUE! Lotus 1-2-3







=A1+A2 #VALUE!

Excel
Excel Lotus 1-2-3
Excel 2010
File > Options > Advanced >



Lotus compatibility Settings for:
Lotus 1-2-3

Copyrightofwww.ExcelExpertTraining.com

39

Transition formula evaluation (Excel 2007 Office File Excel

Transition formula evaluation)


2003 Tools > Options > Transition >

Transition formula evaluation



Lotus 1-2-3



Excel

Excel


Lotus 1-2-3
Lotus 1-2-3
Excel

Lotus 1-2-3 0 ( Excel
)
Transition formula entry


Lotus 1-2-3
release 2.2
Excel

Excel
Transition navigation keys

Tab

Lotus 1-2-3


Excel


Copyrightofwww.ExcelExpertTraining.com

40


0
a


A1 a
0
=A1=0 FALSE =A1>999999999
TRUE
Excel Infinity
=Sum(A1,123) 123 Excel
Sum


0
=A1+123 #VALUE! Excel

Excel Lotus 1-2-3

Sum


Excel #VALUE!

Copyrightofwww.ExcelExpertTraining.com

41


Excel 2007




65,536 row 256 column
1,048,576 row 16,384 column
Excel

paste


save hard disk


(


save )
Excel





Excel 2007



Excel 2003


Excel




ICO


1. 3 Input, Calculate,
Output ( ICO)

2. Input

Input


2.1. row
Alt+Enter



2.2. column column

column



Copyrightofwww.ExcelExpertTraining.com

42

2.3.
1

Input


3. Calculate
Input Calculate


F4

$




Calculate



4. Output



ICO



Excel





I C O







100
Excel 100




ICO
Input
Input Calculate


Output

Output

Output

Output


30
1
1 - 30

2
31 60 3 61 - 90


VLookup, Match, Index
Copyrightofwww.ExcelExpertTraining.com

43

ICO



1. Input



1.1.

Input (

Ctrl


Font


Input)
Locked
1.2. Format Cells > Protection >

1.3. Review > Protect Sheet (Excel 2003 Tools > Protection > Protect
Sheet)
1.4. Protect Sheet
Input
Tab Excel Input
2. Calculate Output






Protect


(
Unprotect Sheet )
2.1.

Calculate Output
Hidden

2.2. Format Cells > Protection >

Formula Bar Copy


Locked
Copy
(
)

2.3. Review > Protect Sheet (Excel 2003 Tools > Protection > Protect
Sheet)
Copyrightofwww.ExcelExpertTraining.com

44


Excel





Excel


Excel


Excel

...
Excel

link


Excel




Unhide Sheet


link

link



link
Cache Data




( Microsoft Excel

)
link
link






link



link

link
1.


1.1.

=

Copyrightofwww.ExcelExpertTraining.com

45




1.2. ( link
)
View > Switch Windows

(Excel 2003 Windows



)
1.3.
1.4.
Enter
link
(
Array
link
Absolute )
2. Copy Paste Special Paste Link

2.1.



2.2. Copy


2.3. ( link
)
View > Switch

Windows (Excel 2003 Windows

)
2.4.
Paste
Special > Paste Link link

3. Cut Paste

link


link

Cut
Paste



Excel

3 link
link




Cut


link

Copyrightofwww.ExcelExpertTraining.com

46

Cut




link
link

=A1
link


Cut


=Sheet1!A1

Cut


=[Source.xlsx]Sheet1!A1
Sheet1


Source

Source



='D:\Dummy\[Source.xlsx]Sheet1'!A1
Drive D
Dummy



Source




link

1. link link








Excel



link ( Excel


Workspace )
Save
2. Save as


Save Save
Excel Save Excel

Excel

(


Windows Explorer

)
3.
Excel link


2 link


Excel


link
3.1.
(


Excel link )

Copyrightofwww.ExcelExpertTraining.com

47

Protect Sheet (
Protect
3.2.


link


Excel )
3.3.
Data > Edit Links (Excel 2003 Edit > Links)


Source
3.4.

3.5. Change Source

4.
Edit Links


4.1. Update Values update
Source
update

( update Excel
update


)

Update Values




Source
4.2. Open Source
4.3. Break Link




link
value
Excel
link


Undo
link

Source



link

Copy Paste Special Value


Copyrightofwww.ExcelExpertTraining.com

48


Link File Excel 2010
Excel 2010 1,048,576 rows 16,384 columns


Excel












1-3
4-6
7-9
10-12

link
Change Sources

link


link


Excel 2010
link Change Sources
Excel
Excel 2010

Excel 2010

link
link file Excel 2010



link

link
Trusted
Excel 2010
link
Download

Location Trusted Document (


www.ExcelExpertTraining.com/download/testlink.zip)
1.


Save
Target.xlsx 8.18 KB

Target Operations B2
2.
8.55 KB
8.18 KB
20496 C2

8.57 KB (
)

Copyrightofwww.ExcelExpertTraining.com

49

Source.xlsx
3.

200
x 119.1 KB

4. Tarrget C2

link
Source

Opeerations
De
epartment



Actual
A
204
496
Arra
ay {=SUM((Source.xxlsx!DEPAR
RTMENT=B
B2)*Sourcee.xlsx!ACTU
UAL)}
Target

8.57 KB
K 12.5KB (


link

cache data




cache dataa )

5.
Source

T
Target



Targett

12.5 K
KB



Operrations Security
R&D



Source

Target

( cache
c
dataa

Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

50

Target)

Ask to
6.
File > Options > Advanced
d > Exxcel
update automatic lin
nks

Target
Target

7.

Security Warning

Autom atic update


e of
b
disabled


In
nfo
links has been


The fo
ollowing co
ontent has been disabled: Workkbook linkss

Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

51

8.
Home
H
En
nable Content R&D

Operatiions

R&D

9.
Source
Se
ecurity Warning
Target
Enable Content

Update Link


10. Ta
arget
11. Sou
urce

Actual
Departm
ment Operations

2562 Sav
ve Souurce




Ta rget

Operationss

Targe
et
12. So
ource
Tarrget

Secu
urity

Warning

Operaations


7-8
7
13.
Enable Content
C
Security Warning
W


Operationss 2562


Sourcee

Enable Content
Exxcel update
e cache da
ata Target

Sou
urce
14. Ta
arget
Saave
Targ
get


Excel 2010
0 Seccurity Warn
ning
Operationss

Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

52


256
62


Exce
el




15. Trrust Centerr

Excel 22010

Disable
Trusted Do
ocument
defau
ult

D
Trussted Docum
ments


Excel Target


Enable Co
ontent (Ex
xcel


save
e
Targe
et ))

16.
15
C
Clear





Targeet

Excel SSecurity Wa
arning

7
Disable Trrusted Doc

15

cuments


17.

Trusted Do
ocument
Target
Exccel Se
ecurity
Warning

7

Enab
ble Contentt Saave Ta
arget

Updatte

Trusteed Docume
18. 17
ent Trusted
Locations

Source Target

Targeet

Sec
curity Warnning

Excel

E
linkk


Excel

Seccurity Warn
ning Exxcel 2010

Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

53


Ex
xcel


Disable Trusted

Docum
ments

Trusted Do
ocument

Trrusted
Locatio
ons

Ask to u

update auto
omatic link
ks 6

Trusted
T
Loccations Trussted Docum
ment Excel 201
10

Securitty Warning
g
Ask to update aautomatic links
l

Ex
xcel 2010





Excel 2
2003 Excel
E




Excel 20
010

Excel 2010


link Trust
En
Center Exterrnal Conten
nt

nable autom
matic updaate for all
Pro
Workbo
ook Links (
(
)

ompt user on
o automaatic update
e for
Workbo
ook links

Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

54



Excel
















Excel 2007


Column
Row =JAN2009
Column JAN Row
2009 Jan ..2009


Excel
Excel



Ribbon )

(
IV)
Column A B C D XFD (Excel 2003 Column
SUM, MAX, MIN, VLOOKUP
Excel









Excel





1.














(Range
2.



(Formula Name)

Name)
(Constant Name)


3.

Enter


Excel
3.1.


3.2.



3.3.

Excel



Copyrightofwww.ExcelExpertTraining.com

55


Column
4.

4






2-3


Jan2009

JAN2009 Column JAN Row 2009 (

C R Row Column)
Range Name
5. Excel

Excel




Range Name
_ (Underscore) Excel




6.

Excel version




History
Excel

7.

Range Name
Criteria Extract
Criteria
8.


Extract Advanced Filter

9. Data Form
Data Form
Database
Excel





10.


www.ExcelExpertTraining.com

VLookup,




SumIF, SumProduct



Range Name, Formula Name, Constant Name
Excel 2003

Insert > Name > Define Add


2
Excel 2007
Formulas > Define Name
1.

Copyrightofwww.ExcelExpertTraining.com

56




2.


Formulas > Name Manager


2.1. New


2.2. Edit


2.3. Delete

Excel 2007
File Level Sheet Level


File Level Excel Scope

Workbook




Sheet Level
Scope


( Scope


Refers to )

Copyrightofwww.ExcelExpertTraining.com

57

Constant Name



Constant Name















Constant Name



Constant Name

Constant Name MyKey1
Excel Expert


Name (
Training



)
Refers to






Name: MyKey1
Refers to: =Excel Expert Training
Constant Name




Name: MyKey2
Refers to: =23187021
Constant Name




=mykey1 (





) F3




( OK) Enter

=MyKey1 Excel Expert Training

Copyrightofwww.ExcelExpertTraining.com

58

Range Name Formula Name






Constant Name

Range Name



Range Name


(





)




Formula Bar

1. Name Box




Name Box


1.1.

(

Ctrl



)
Name Box
Range Name
1.2.

Name Box

Name




Box





Name Box
1.3. Enter


2.
Formulas > Define Name Formulas > Name Manager


(Excel 2003
Insert > Name > Define)

Name:
Refers to (

Copyrightofwww.ExcelExpertTraining.com

59

Refers to: )





OK



3.
Formulas > Create from selection (Excel 2003
Insert

> Name > Create)
















Formulas > Create from Selection


OK

Left column

Excel
Column



Excel

C2:E2 Income


C3:E3 Cost Column

Income Cost
Excel Create


from selection


Column


Range Name
Insert Row Insert Column

2
3


Copyrightofwww.ExcelExpertTraining.com

60


Range Name

Excel
Income
Range Name

1. =sum(


2. F3

(


Range Name




F3)
Income =sum(Income
3.


4. Enter =SUM(Income)
Range Name Excel




2









B3:B5 Left
C2:F2 Top
=Top*Left

Top Left


C3:F5

Error
#VALUE!



Top


Left =Top*Left =Top*Left






Top
Left




Error
Copyrightofwww.ExcelExpertTraining.com

61

Formulas > Name Manager Excel


Top Left



Absolute
$ Row Column

Top Refers to: =Sheet1!$C$2:$F$2


Left Refers to: =Sheet1!$B$3:$B$5




$ Row Column
Top Left





$
$







C$2

$ Row







$
$B3
Column




$
Copyrightofwww.ExcelExpertTraining.com

62







!I5

!

$ Absolute



Formulas > Name Manager
Refers to:


TopRow LeftColumn (
)
1.

Row 2 Column B
1.1. C3 Formulas > Name Manager
TopRow Refers to: =Sheet1!C$2
1.2.
LeftColumn Refers to: =Sheet1!$B3
1.3.
Sum3Above (
)
2.


3






2.1. C13 Formulas > Name Manager
Sum3Above Refers to: =SUM(Sheet1!C9:C11)
2.2.
Left2 (
)
3.


2





3.1. G10 Formulas > Name Manager
Left2 Refers to: =!E10
3.2.

Copyrightofwww.ExcelExpertTraining.com

63

Formula Name



Constant Name Range Name
Formula Name
Refers to:



Constant Name

Range Name
Refers to:



Refers to:

=5*Top*Left 5


Top Left

=SUM(Income)
Excel

=(5*Top*Left)+Sum(Income)
MyVar1 =5*Top*Left
=MyVar1+MyVar2
MyVar2 =SUM(Income)

Dynamic Range Offset



Copyrightofwww.ExcelExpertTraining.com

64

=C2-C3 C4
Copy

Income Cost Range Name
C4:E4


C2:E2 C3:E3 C4:E4


=Income-Cost


C4:E4 Formulas
> Define Name > Apply Names (Excel 2003 Insert > Name > Apply)
Income Cost ( Excel


C4:E4
)
OK







Name Box
Range Name
1.

Name Box F5
2.







Copy
3. Copy



(





)


Paste

Copy





Name Box

4.

Range Name
Income, Sales, Revenue
A1
Name Box
Income I

A1
Name Box

R S

Range Name
Refers to:
5.
Refers to:




Mouse
Refers to:

Range Name
Range
6. Cut


Refers to:
Name

Name Box
Range Name

(

Formulas > Name Manager)

Copyrightofwww.ExcelExpertTraining.com

65

(Intersection)
7.




=Top Left






Top Left
8.

Range Name


2

Range Name
=


9. Formula Name Absolute Reference

Now()
Sum3Above Refers to: =SUM(Sheet1!C9:C11)*Now()/Now()
Today()






10.


Copy

Paste Paste

Copyrightofwww.ExcelExpertTraining.com

66





Copy







Copy








1 :
Indirect(Text )

A1 =A1

A2

=A2

=A1

C4
C5 a 1

C6 =C4&C5 a1 Text


C6
Excel (
C4 C5
a1

)

C7 =Indirect(C6) 11 A1

C6

Column Row

Copyrightofwww.ExcelExpertTraining.com

67

C4 C5


C6

a2 C6 C7 a2

a3 C6 C7 a3

sheet3!a2 C6 C7

Sheet3



a2

2 :
Indirect(Text )






:
A1:A3

Indirect

A1:A3 =Sum(A1:A3)

A1:A3

a1 C6 Indirect
Text


E4, E5, E6 Text

a3


D8
:
=C6&:&E6 a1:a3
Copyrightofwww.ExcelExpertTraining.com

68

Text
D8 Sum
D9 =Sum(Indirect(D8))
Indirect


D8
=C6&:&E6 Sum






=Max(Indirect(D8)),
Indirect
=Min(Indirect(D8)), =Average(Indirect(D8)), =Index(Indirect(D8),2,1)


=$C$6&:&$E$6 =Indirect($C$6&:&$E$6)

Formula Name MyRange1 MyRange2 (

Formula Name Absolute )




=Sum(Indirect(D8)) =Sum(Indirect(MyRange1))
=Sum(MyRange2)



D8



Range

3 :
Indirect(Text )
Name

Range Name









D3:D6 Chonburi

C4:E4

Year2 ( Formulas > Create from selection





)
Copyrightofwww.ExcelExpertTraining.com

69

Range Name
Chonburi


C9 C10
Year2

D9 Chonburi =Sum(Indirect(C9))

D10 Year2 =Sum(Indirect(C10))

E9 Chonburi Year2 Intersection


=Indirect(C9) Indirect(C10)



Indirect

Excel

Excel

VLookup ) Indirect


Indirect link




Volatile Function

Volatile Function










(





)


Volatile

Volatile Function Areas, Cell, Column, Columns,


Indirect, Info, Now, Offset, Rand, Row, Rows, Today

4 :


Indirect


Excel







Indirect

Copyrightofwww.ExcelExpertTraining.com

70

IF, Choose,





Index, Offset

VLookup, Match



Index Offset, Address
Indirect

Copyrightofwww.ExcelExpertTraining.com

71

(Circular Reference)





Excel


Excel




Excel



Excel
Circular Circular Reference


Excel





Circular Reference
A1





=A1 B3 = B1+B2+B3




link

link
A1
=A3 A2
=A1 A3
=A2


(Circular Calculation)
Copyrightofwww.ExcelExpertTraining.com

72

allocate

Excel



=Number+A1 A1

=Max(A1,NumberRange) A1

Excel
Goal Seek Solver Add-in



Excel
Visual Basic

Copyrightofwww.ExcelExpertTraining.com

73

Circular Reference

1.


(
Circular
Reference)
Circular Reference

Excel Circular

Excel Circular
Reference



2.
Circular Reference Cancel

Circular References:

Excel

Formulas > Error Checking >


Circular References

3.
Excel Circular Reference File > Options
Enable iterative calculation (Excel 2003 Tools > Options
> Formulas >

Copyrightofwww.ExcelExpertTraining.com

74

Iteration)
> Calculation >

Maximum Iterations
Maximum Change
4.


2

Excel 100 100


.001





Enter
F9

Excel
Maximum Iterations
4.1.


F9




F9


Maximum Change
4.2.
Excel
Maximum Iterations



5. 3

2 Calculate


Excel
F9
Calculate
(


Manual
Calculate

F9

Manual Calculate
)
6.




Enable iterative calculation



Excel

Formulas > Error
Checking > Circular References



Circular reference

Copyrightofwww.ExcelExpertTraining.com

75



Circular





Excel








7.
Circular






8.






Iterations





Iterations

Enable
9. Excel Excel
Excel
iterative calculation






1.

:

!)

3 =SUM(
Sheet1
=SUM(Sheet1:Sheet3!A1)
A1



Sheet3

Sheet1
Sheet3
1.1. =sum(

1.2.


1.3. Shift

1.4. Enter


2.


=SUM('*'!

Sheet1
)
=SUM('*'!A1)
=SUM(Sheet2:Sheet3!A1)

Copyrightofwww.ExcelExpertTraining.com

76


3.




Excel View > Custom Views > Add






View > Custom Views
View
(



View


Print settings Filter

)
settings




4.

Hide

Custom View
Hide

5.

Column A Row 1

Column A
Row 1
Margin

6. Merge


Merge



Copy

Merge


Merge


Merge

Format Cells > Alignment > Center Across Selection



7.
Cut







Cut (









link
Copyrightofwww.ExcelExpertTraining.com

77

Excel
)

Paste Paste




8.
Copy




Copy

Paste
Copy Paste
9.
Protect Sheet

$
Replace

(
$

)
10. Insert Row Insert Column


A1:A10
Array

=0
= (=

)
Ctrl+Shift+Enter Insert Row Row 1 Row 10
11. Windows Explorer copy Excel link
drive

Copy link

link
MyExcelFile Copy

MyExcelFile link


MyExcelFile

Copy drive

MyExcelFile






MyExcelFile)
link Excel
(


12.










Copyrightofwww.ExcelExpertTraining.com

78





F2

F3







Paste List

F4

F5




Special

F8


(Extend)

F9

Shift + F9

F2 F9



Esc

Ctrl + * Ctrl+a



(Current Region)

Ctrl + .

Active Cell

Ctrl + Shift +

Shift + End

Ctrl + PgUp

Ctrl + PgDn

Ctrl + Tab

Ctrl + Shift + Tab

Ctrl + Shift + Enter

Array
{ }

Copyrightofwww.ExcelExpertTraining.com

79


1.



2.




3.











4.














5.












6.

Excel
Format
Locked
Cells > Protection
Review > Protect
Sheet (Excel 2003 Tools > Protection > Protect Sheet)

Tab

Copyrightofwww.ExcelExpertTraining.com

80

Goal Seek
3 30 10
10*3 = 30

3 77.77



77.77
3

Goal Seek

Goal Seek



Goal Seek

Excel


Goal Seek

3 77.77
1. 2*3 6

2. Data > What-If Analysis > Goal Seek (Excel 2003 Tools > Goal Seek)

Set cell: D2
3.


To value: 77.77
By

changing cell: B2 B2


Copyrightofwww.ExcelExpertTraining.com

81

4. OK Excel
2 B2 25.92333
C2 77.77 OK

Goal Seek

5.
Data > What-If Analysis > Goal
Seek

Goal Seek

G18
15%

G16 H17
20%
1,000

G17
=H17*G16
200 (
20% ) G19


=G16-G17
G18 G18


H18

=G18/G19

0




15%


=.15*G19 G18
=.15*G19

G18 (
Iteration

)

Copyrightofwww.ExcelExpertTraining.com

82





Goal Seek
Data > What-If Analysis >
Goal Seek

Set cell: H18


1.


=G18/G19
To value: .15
2.

By changing cell: G18
3.

4. OK > OK 104.50377964375 Goal


Seek


Goal Seek



Copyrightofwww.ExcelExpertTraining.com

83


100%




Goal Seek

G18



15%
Goal Seek

G18 15% 20%


Goal Seek


Goal Seek

Goal Seek Goal Seek









To value link

Goal Seek
Goal Seek
Goal Seek
Goal Seek
Macro

Recorder Data > What-If Analysis > Goal Seek

VBA
Sub SetGoal()
Range("H18").GoalSeek Goal:=0.15, ChangingCell:=Range("G18")
End Sub
Range Name




Sub SetGoal()
[MyTarget].GoalSeek Goal:=[TargetValue], ChangingCell:=[ChangeCell]
End Sub
Copyrightofwww.ExcelExpertTraining.com

84

Range Name
MyTarget H18
ChangeCell


G18



TargetValue

Goal Seek Event
Goal Seek





Calculation Event

Private Sub Worksheet_Calculate()


[MyTarget].GoalSeek Goal:=[TargetValue], ChangingCell:=[ChangeCell]
End Sub

Copyrightofwww.ExcelExpertTraining.com

85

Data Table


Excel




Data Table

Data Table






Data

Help
Data Table




Data Table
Excel





Data Table






Excel
Data Table

Data Table
Excel loop Excel

loop Data Table loop




Data Table 3

Data Table 1

Data Table 2

Data Table Index (




Scenarios)

Data Table 4

Copyrightofwww.ExcelExpertTraining.com

86

Data Table 1
100 400


Data Table





Data Table





Data Table 1 2

Data Table
Column Input Cell
link
Data Table

Data Table
Row Input Cell
link
Data Table

Data Table

Copyrightofwww.ExcelExpertTraining.com

87

1. E23:E27

2. F22 G22 link G19
H18
3.
E22:G27 Data > What-If Analysis > Data Table (Excel
2003 Data > Table)
Column input cell G18 (
4.
Data
Table G18) OK
5. F23:G27
{=TABLE(,G18)}

Data Table

(,G18) Row Input Column Input


G18

Data Table


1. Data Table 1

link

Data Table 2 2


2. 2
If,
Choose Index Data Table

Copyrightofwww.ExcelExpertTraining.com

88

3. Excel
Data table


Array

=Table(Row Input Cell, Column Input Cell)
Data Table 1 =Table(Row Input Cell,)

Row Input =Table(, Column Input Cell)

Column Input Data Table 2


=Table(Row Input Cell, Column Input Cell)

4. Data Table



%

5. G18
Data Table
Data Table

6. Data Table Copy


Paste
Table

7. Insert
Table Table





Table

Data Table 2



Copyrightofwww.ExcelExpertTraining.com

89

1. F22:H22 Row Input


2. E23:E27 Column Input
3. E22 =G19
link

4.


E22:H27 Data > What-If Analysis > Data
Table (Excel 2003 Data > Table)
Row Input Cell G17
5.

Column Input Cell G18


6.
OK
F23:H27

Data Table Goal Seek


1. Data Table



Excel

Goal Seek 1

2. Data Table






Goal Seek

3. Formulas > Calculation Options > Automatic Except for Data Tables
(Excel 2003 Tools > Options > Calculation > Automatic except tables)


F9
Data Table


Goal Seek Automatic Manual
Goal Seek Automatic




Excel
4.
Data Table

Goal Seek
Excel

5. Data Table
Goal Seek
Data Table Goal Seek Data Table



Data table
Copyrightofwww.ExcelExpertTraining.com

90

IF

Excel






SUM IF " "





IF




IF
,

=IF ( IF ,
)
IF

=IF ( , ,
)
IF




Excel

IF


IF
=IF(
,

,

)





=, >, <,
>=, <=, <>

Copyrightofwww.ExcelExpertTraining.com

91

AND, OR, TRUE, FALSE, ISNUMBER


TRUE FALSE

IF
=IF(SaleChoice="n", 1000, 2000)
SaleChoice n

1000

SaleChoice
2000

n Excel "n"

IF SaleChoice


IF SaleChoice
Excel IF
1000 2000 Excel
Range Name




=IF(MyMargin>0, MyMargin*0.3, 0)
MyMargin
0


30%

IF

1.


2.

3.

4.

Copyrightofwww.ExcelExpertTraining.com

92

IF


1 1




A2 A1 =A1 A2 A2

A1 A1
A2
C2 C3
1
E3

C2 C3


E2
A B
(
) E3
=IF( E2="A", C2, C3)


E2 A E3 100 C2 E2

A E3

200 C3




14

Copyrightofwww.ExcelExpertTraining.com

93

F9

=IF(E9="A",C2,IF(E9="B",C5,IF(E9="C",C8,IF(E9="D",C11,IF(E9="E",C14,IF(
E9="F",C17,IF(E9="G",F2,IF(E9="H",F17,IF(E9="I",I2,IF(E9="J",I5,IF(E9="
K",I8,IF(E9="L",I11,IF(E9="M",I14,I17)))))))))))))
E9 K IF F9 I8
IF

F9

Copyrightofwww.ExcelExpertTraining.com

94

=IF(E9="A",C2,IF(E9="B",I3,IF(E9="C",J11,IF(E9="D",F2,IF(E9="E",I9,IF(E9
="F",J16,IF(E9="G",H14,IF(E9="H",E14,IF(E9="I",G17,IF(E9="J",H7,IF(E9=
"K",C8,IF(E9="L",D6,IF(E9="M",D12,C17)))))))))))))
E9 K F9 1100 C8
K X
1100

Excel 2007
64

(Excel 2003


7 )

IF
IF






IF


IF

Copyrightofwww.ExcelExpertTraining.com

95

IF
IF =IF(
,, )






IF

IF


2
IF




1. IF

2. IF

IF

IF

IF




=IF(
1,
1,
1)

1 IF



1

2


=IF(
2,
2,
2)






=IF(
1,
1, IF(
2,

2,
2) )

Copyrightofwww.ExcelExpertTraining.com

96

IF

B3:C5 -

90
A

70
B

0
C

E3 75
F3 B

IF

=IF( E3>=B3, C3, IF(E3>=B4,C4,C5) )





=IF(
>=90, "A", IF(
>=70,"B","C") )

IF

1. IF

IF



>=90






(
>=70

A
>=70 >=90
)


2. A, B, C IF
2 IF

Copyrightofwww.ExcelExpertTraining.com

97

IF


=IF(
1, IF(
2,
1 2,

2),
1)




1


2
IF

And Or IF
=IF( And(
1,
2), , )
=IF( OR(
1,
2), , )

1. And




( False )
2. OR




( True )

Copyrightofwww.ExcelExpertTraining.com

98

IF

1 2 B2 C2

B2+C2 B4 B5
123 999
IF D2
IF
=IF( B4=123, IF(B5=999, B2+C2, 0), 0)

And
IF
=IF( AND(B4=123,B5=999), B2+C2, 0)

Copyrightofwww.ExcelExpertTraining.com

99

IF

100 2-5 Range Name

From
B3:B8

To
C3:C8

Amount
D3:D8

Date
E2:K2

E3

=IF( Date>=From, IF(Date<=To,Amount,0), 0)

=IF( AND(Date>=From,Date<=To), Amount, 0)



And True 2-5

( E8:K8)

Copyrightofwww.ExcelExpertTraining.com

100

IF




IF



Error

Row 2






100 B2 5
C2 = B2/C2 D2 20
Row 5
5 0 =B5/C5
Error #DIV/0! (#DIV/0! Error from
Divided by Zero Error
0)

Error 0 Row 8
=IF(C8=0, 0, B8/C8)
0 0
Error 0
0 o IF


#VALUE! Excel
Row 11
o (
)
Error IsError Error
Copyrightofwww.ExcelExpertTraining.com

101

=IF( ISERROR(B11/C11), 0, B11/C11)



Excel 2007 IfError

=IFERROR(B11/C11,0)

1.
IsError


IsError IF
Error

2.

IsError
IsError
3. Error

Text
Error

Error 0
Format
0

0;-0;

4.
Error
Null Text

"" (
0) "" Text

Error =IF(Cell="", "",

Cell)


5.
#N/A NA()
6. IF
Error


Page Setup > Sheet > Print > Cells error as

, --, #N/A



Error

Is

IsNA Error #N/A "Not Available"


Lookup

IsError Error

IsErr Error NA

IsBlank

Copyrightofwww.ExcelExpertTraining.com

102

IsText
Text


'123 Text


IsNumber
Number


10/4/2010
Number

IF








VBA

Source Target1 Target2


-111 -111
Source 0
Target1

222 222
Source 0
Target2

Source, Target1, Target2 C2, C5 ,C6


Target Formula Name
=IF( Source<0, Target1, Target2)


Visual Basic Editor
Sub SendData()
Copyrightofwww.ExcelExpertTraining.com

103

MyVar = [Source]
[Target] = MyVar
End Sub

Source

1.





MyVar
Target
2.
MyVar Formula Name

Target =IF( Source<0, Target1, Target2)
3.
Target1
Source

Target2

Copyrightofwww.ExcelExpertTraining.com

104

IF


IF





Excel
2007


64 IF Excel 2003

Excel

IF
IF

D9 IF

=IF(F9>C9,1,IF(SUM(F9:G9)>C9,2,IF(SUM(F9:H9)>C9,3,IF(SUM(F9:I9)>C9,4,IF(SU
M(F9:J9)>C9,5,IF(SUM(F9:K9)>C9,6,IF(SUM(F9:L9)>C9,7,0)))))))
+IF(SUM(F9:L9)>C9,0,IF(SUM(F9:M9)>C9,8,IF(SUM(F9:N9)>C9,9,IF(SUM(F9:O9)>
C9,10,IF(SUM(F9:P9)>C9,11,IF(SUM(F9:Q9)>C9,12,IF(SUM(F9:R9)>C9,13,0)))))))
+IF(SUM(F9:R9)>C9,0,IF(SUM(F9:S9)>C9,14,IF(SUM(F9:T9)>C9,15,IF(SUM(F9:U9)
>C9,16,IF(SUM(F9:V9)>C9,17,IF(SUM(F9:W9)>C9,18,IF(SUM(F9:X9)>C9,19,0)))))
))
+IF(SUM(F9:X9)>C9,0,IF(SUM(F9:Y9)>C9,20,IF(SUM(F9:Z9)>C9,21,IF(SUM(F9:AA9
)>C9,22,IF(SUM(F9:AB9)>C9,23,IF(SUM(F9:AC9)>C9,24,IF(SUM(F9:AD9)>C9,25,0)
))))))
Copyrightofwww.ExcelExpertTraining.com

105

+IF(SUM(F9:AD9)>C9,0,IF(SUM(F9:AE9)>C9,26,IF(SUM(F9:AF9)>C9,27,IF(SUM(F9:
AG9)>C9,28,IF(SUM(F9:AH9)>C9,29,IF(SUM(F9:AI9)>C9,30,IF(SUM(F9:AJ9)>C9,31
,0)))))))
Stock

IF

F9 2
F9:G9 3 F9:H9
F9:AJ9

31 Stock C9

Excel 2003



7

0 IF

,0))))))) IF


IF IF
Excel 2007

64
=IF(F9>C9,1,IF(SUM(F9:G9)>C9,2,IF(SUM(F9:H9)>C9,3,IF(SUM(F9:I9)>C9,4,IF(SU
M(F9:J9)>C9,5,IF(SUM(F9:K9)>C9,6,IF(SUM(F9:L9)>C9,7,IF(SUM(F9:M9)>C9,8,IF(
SUM(F9:N9)>C9,9,IF(SUM(F9:O9)>C9,10,IF(SUM(F9:P9)>C9,11,IF(SUM(F9:Q9)>C9
,12,IF(SUM(F9:R9)>C9,13,IF(SUM(F9:S9)>C9,14,IF(SUM(F9:T9)>C9,15,IF(SUM(F9:
U9)>C9,16,IF(SUM(F9:V9)>C9,17,IF(SUM(F9:W9)>C9,18,IF(SUM(F9:X9)>C9,19,IF(
SUM(F9:Y9)>C9,20,IF(SUM(F9:Z9)>C9,21,IF(SUM(F9:AA9)>C9,22,IF(SUM(F9:AB9)
>C9,23,IF(SUM(F9:AC9)>C9,24,IF(SUM(F9:AD9)>C9,25,IF(SUM(F9:AE9)>C9,26,IF(
SUM(F9:AF9)>C9,27,IF(SUM(F9:AG9)>C9,28,IF(SUM(F9:AH9)>C9,29,IF(SUM(F9:AI
9)>C9,30,IF(SUM(F9:AJ9)>C9,31,0)))))))))))))))))))))))))))))))
IF




IF

=(F9<=C9)+(SUM(F9:G9)<=C9)+(SUM(F9:H9)<=C9)+(SUM(F9:I9)<=C9)+(SUM(F
9:J9)<=C9)+(SUM(F9:K9)<=C9)+(SUM(F9:L9)<=C9)+(SUM(F9:M9)<=C9)+(SUM(F
9:N9)<=C9)+(SUM(F9:O9)<=C9)+(SUM(F9:P9)<=C9)+(SUM(F9:Q9)<=C9)+(SUM(
Copyrightofwww.ExcelExpertTraining.com

106

F9:R9)<=C9)+(SUM(F9:S9)<=C9)+(SUM(F9:T9)<=C9)+(SUM(F9:U9)<=C9)+(SUM
(F9:V9)<=C9)+(SUM(F9:W9)<=C9)+(SUM(F9:X9)<=C9)+(SUM(F9:Y9)<=C9)+(SU
M(F9:Z9)<=C9)+(SUM(F9:AA9)<=C9)+(SUM(F9:AB9)<=C9)+(SUM(F9:AC9)<=C9)
+(SUM(F9:AD9)<=C9)+(SUM(F9:AE9)<=C9)+(SUM(F9:AF9)<=C9)+(SUM(F9:AG9)
<=C9)+(SUM(F9:AH9)<=C9)+(SUM(F9:AI9)<=C9)+(SUM(F9:AJ9)<=C9)+1
Array
{=SUM((SUBTOTAL(9,INDIRECT(ADDRESS(ROW(F9),COLUMN(F9))&":"&ADDRESS(
ROW(F9),ROW(INDIRECT(COLUMN(F9)&":"&COLUMN(AJ9))))))<=C9)*1)+1}

IF
Choose Index
Choose Choose


1 - 254 (Excel 2003
1 - 29)

=CHOOSE(, 1
, 2
, .... 254)
Choose IF 2





Choose
1 - 254


IF



Choose

IF
=IF(E9="A",C2,IF(E9="B",C5,IF(E9="C",C8,IF(E9="D",C11,IF(E9="E",C14,IF(
E9="F",C17,IF(E9="G",F2,IF(E9="H",F17,IF(E9="I",I2,IF(E9="J",I5,IF(E9="K
",I8,IF(E9="L",I11,IF(E9="M",I14,I17)))))))))))))

E9
A - M
E9 A C2 E9 B
C5

Copyrightofwww.ExcelExpertTraining.com

107

IF




Choose






=IF(E9=1,C2,IF(E9=2,C5,IF(E9=3,C8,IF(E9=4,C11,IF(E9=5,C14,IF(E9=6,C1
7,IF(E9=7,F2,IF(E9=8,F17,IF(E9=9,I2,IF(E9=10,I5,IF(E9=11,I8,IF(E9=12,I
11,IF(E9=13,I14,I17)))))))))))))

IF
E9
1 - 13
E9 1 C2 E9 2
C5

IF
1 - 13

254

(

) Choose

=CHOOSE(E9, C2,C5,C8,C11,C14,C17,F2,F17,I2,I5,I8,I11,I14,I17)
E9 1 C2 E9 2
C5 E9 14 I17



Choose

=CHOOSE(E9, C2,C5,C8,C11,C14,C17,F2,F17,I2,I5,I8,
I11,I14,I17,D3,D6,D9,D12,D15,D18,G3,G18,J3,J6,J9,
J12,J15,J18,E4,E7,E10,E13,E16,E19,H4,H19,K4,K7,
K10,K13,K16,K19)



Choose
254


Choose

Copyrightofwww.ExcelExpertTraining.com

108

Index
Choose Index
=INDEX(

Single Row, )

=INDEX(

Single Column, )
Single Row Single Column




IF Choose


1
Index

=INDEX(A1:A10000, E9)
E9 1 A1 E9 2
A2 E9 10000
A10000

A1:A10000









IF

Choose Index

Copyrightofwww.ExcelExpertTraining.com

109

IF
VLookup
VLookup Vertical Lookup







Column
Column

Column VLookup 2
Approaching Match

Column



=VLOOKUP( ,
, Column )
Exact Match

Column

=VLOOKUP( ,
, Column ,
FALSE 0)
IF A B C =IF( E3>=B3, C3,
IF(E3>=B4,C4,C5) )


VLookup

Copyrightofwww.ExcelExpertTraining.com

110

F3 =VLOOKUP(E3,B3:C5,2) VLookup Approaching

Match






B
1. VLookup
75 B3:C5

2. Column

70



75


70
VLookup Column
3. 2


B3:C5 Column
B
Exact Match =VLOOKUP(E3,B3:C5,2,0)
0

#N/A
Column
75

Not Available
Excel

VLookup


IF
VLookup

Copyrightofwww.ExcelExpertTraining.com

111

IF
Max Min








0

IF

0
0

=IF( <0, 0, )

=IF( >=0, , 0)

IF


Max Min

Max Min

Max


)
=MAX(
,

Min


=MIN(
,

)

IF 0

Max


=MAX(0, )

100 IF Min

Copyrightofwww.ExcelExpertTraining.com

112

=IF( >100, 100, )

=IF( <=100, , 100)

=MIN(100, )


=( <=0)*0 + ( >0)*



1.




2.


3.

0
1
4.






-5

0

=( <=0)*0 + ( >0)* Excel

1. =(-5<=0)*0 + (-5>0)*-5
2. (-5<=0) TRUE 1
3. (-5>0) FALSE 0
4. =1*0 + 0*-5
5. =0 + 0
Copyrightofwww.ExcelExpertTraining.com

113

6. -5 0
5
=( <=0)*0 +
( >0)* Excel

1. =(5<=0)*0 + (5>0)*5
2. (5<=0) FALSE 0
3. (5>0) TRUE 1
4. =0*0 + 1*5
5. =0 + 5
6. 5 5








Array

Copyrightofwww.ExcelExpertTraining.com

114

IF
Format

Excel
Excel

IF


IF IsNumber

Input is Wrong

=IF(ISNUMBER(Cell), "OK", "Input is Wrong")





IF

Format


Input is Wrong

Format
0;-0;0;"Input is Wrong"
Format Input is Wrong






Excel


Data Validation

Conditional Formatting

Copyrightofwww.ExcelExpertTraining.com

115

Data Validation





Excel

Range Name
B2:B7
Choice
1.

2. D2
Data > Data
Validation (Excel 2003 Data > Validation)
Allow List (
Allow
3.


Allow Custom
)
Source F3
Range Name
4.





Choice
5.

OK 2
6. D2





D2

Enter

The value you entered is not valid.

Copyrightofwww.ExcelExpertTraining.com

116

Conditional Formatting
May D2




Choice

May

Choice
1.



2. Home > Conditional Formatting > New Rules > Use a formula to
determine which cells to format (Excel 2003 Format > Conditional
Formatting)
Edit the Rule Description
3. =B2=$D$2
4. Format


5. Data Validation Conditional Formatting

Validation

Conditional

Formatting


Copyrightofwww.ExcelExpertTraining.com

117

Validation Conditional Formatting



Y

D4
B

1.
C3:E4

2.
Conditional Formatting
=C$2&$B3=$C$6&$C$7
3. Data Validation Allow Custom
=C$2&$B3=$C$6&$C$7 Conditional
Formatting ( =And(C$2=$C$6,$B3=$C$7)

Copyrightofwww.ExcelExpertTraining.com

118

Array

Array


Array

Array


Array






Array





Array






" Array "

Array Array


Array

Array
Array
Excel
1.


Array



2.




3. Excel




Sort AutoFilter


4. Excel

Copyrightofwww.ExcelExpertTraining.com

119

Array
Array
Excel









Excel



Array





Pivot Table
Pivot Table Array

Pivot Table

Array

1.

Array

Array


2.

Array

Array Ctrl+Shift+Enter
Enter
Array
3.





Excel
Array

Array

Array
Array

Array Excel Expert Forum


Array



Array











Copyrightofwww.ExcelExpertTraining.com

120







Array
Array



Array



Array
Unique Items

{=SUM(1/CountIF(DataRange,DataRange))}
aa, bb, aa, cc, bb

DataRange
3 aa, bb, cc
3

{ }






DataRange
Ctrl+Shift+Enter








DataRange aa, bb, aa, cc, bb
DataRange

aa 2

aa 1/2


bb 1/2
bb 2

cc 1

1


DataRange aa, bb, aa, cc, bb
=1/2+1/2+1/2+1+1/2 Unique Items 3







Copyrightofwww.ExcelExpertTraining.com

121

Array


Unique Items

DataRange


Array

Array


2
1. Array F9
Formula Bar

2. Array



F9
(
Esc

Enter
)



Array

Array



Array
1

DataRange B3:B7

Copyrightofwww.ExcelExpertTraining.com

122

D3
Array {=SUM(1/COUNTIF(DataRange,DataRange))}

Ctrl+Shift+Enter ( {} )
Formula Bar
1.

COUNTIF(DataRange,DataRange)
2. F9 CountIF

=SUM(1/{2;2;2;1;2})
3. {2;2;2;1;2} aa 2 , bb 2
, aa 2 , cc 1 , bb 2
4. 1/{2;2;2;1;2}

5. F9 1/{2;2;2;1;2}

=SUM({0.5;0.5;0.5;1;0.5})
6. {0.5;0.5;0.5;1;0.5}
1/2
0.5 1/1 1
7. SUM({0.5;0.5;0.5;1;0.5}) F9 =3
8. Esc


Formula Bar


COUNTIF(DataRange,DataRange)


/COUNTIF(DataRange,DataRange)


F9

Array
2

Array

Copyrightofwww.ExcelExpertTraining.com

123


=SUM(1/COUNTIF(DataRange,DataRange))



1. Step1 D3 =COUNTIF(DataRange,B3) copy
D7
2. D3:D7


DataRange
3. Step2 E3 =1/D3 copy E7
4. E3:E7


DataRange
5. Step3 F3 =SUM(E3:E7)


Unique Items
Step1 Step2
D3 E3
Array

Step1 D3:D7
=COUNTIF(DataRange,DataRange)
Ctrl+Shift+Enter



DataRange

CountIF

DataRange

Step2 E3:E7
=1/D3:D7 Ctrl+Shift+Enter

Copyrightofwww.ExcelExpertTraining.com

124

Array

Array
Array

Array

Array


Array


Array












row column Excel

Array
comma ,

11,22,33

Array
semi-colon ;

11;22;33

Array

2 row 3 column

1,2,3;11,22,33 Array

comma semi-colon
1,2,3 ;
11,22,33

Array


1,2,3
Array



Array Constant
={1,2,3}
1.
1
3
={1,2,3}
Ctrl+Shift+Enter
={1,2,3}

{=




{1,2,3}}

Copyrightofwww.ExcelExpertTraining.com

125

Array


2.
Array {=A1:C1} Array
{=A1:A3} Array 2 row 3
column {=A1:C2}


Ctrl+Shift+Enter
Array

3.

Array
{=Offset(A1,0,0,2,3)} A1:C2



Array 3


Array


Array
Array







Ctrl+Shift+Enter Array Excel




Array

Range Name Top Left



C3:H7

=Top*Left Ctrl+Shift+Enter Array {=Top*Left}

Copyrightofwww.ExcelExpertTraining.com

126



C3:F5
Top Left




C3:F5


Array
Error #N/A




{=Top*Left} F2 F9
Array Constant {20,30,40,50;40,60,80,100;60,90,120,150}

;
2 3 row
row 2

;

,

3 row 4 column


{=Top*Left}
3 row
4 column


Error #N/A
=Top*Left C9
=SUM(Top*Left) Ctrl+Shift+Enter Array {=SUM(Top*Left)}


C9



Array

1. Excel Help


2
Array
2.
Array


F2 F9

Esc



Array
Excel
3.


Array



Array
Current array
F5 > Special >
4. Ctrl+Shift+Enter


{ }


Enter

Ctrl+Shift
Copyrightofwww.ExcelExpertTraining.com

127

5. Array

Ctrl+Shift+Enter Insert Delete


Array

(
Array
Array
)
6. Array

Ctrl+Shift+Enter


Merge
Array formulas are not valid in merged
cells ( Merge
Array )

7. Array

Ctrl+Shift+Enter

8. Array
Ctrl+Shift+Enter


Excel

Array




9. Excel
2003

Array

Ctrl+Shift+Enter



65,536 row
{=MIN(IF(A:A<>0,ROW(A:A)))}
{=MIN(IF(A1:A65536<>0,ROW(A1:A65536)))}

{=MIN(IF(A1:A65535<>0,ROW(A1:A65535)))}
10. Array
Ctrl+Shift+Enter Excel

Array Ctrl+Shift+Enter


SumIF, CountIF, SumIFs, CountIFs, AverageIfs, SumProduct
2

Sum,
Array

Array
Max, Min, And, Or, Index, Offset

Copyrightofwww.ExcelExpertTraining.com

128

11. SumIFs, CountIFs, AverageIfs


Excel 2007

Excel 2003





SumIFs, CountIFs, AverageIfs Sum-IF-Array, Count
IF-Array, Average-If-Array
Excel

Ctrl+Shift+Enter

12. Max, Min, And, Or



Array Array
{=Max(RangeA,RangeB)}

RangeA
RangeB
RangeA RangeB
13. Array



14. Array



error
15. Array







error

16. Array
Range Name


Excel

B4:B8 DataRange
Range Name


= B4:B8
DataRange B4:B8

DataRange
Range

Name F3

Copyrightofwww.ExcelExpertTraining.com

129

17. Excel
Enter Ctrl+Shift+Enter

18.
Array


Ctrl+Shift+Enter


Array Enter

error

Copyrightofwww.ExcelExpertTraining.com

130

Array IF

Array IF



Excel 2007

SumIFs, CountIFs, AverageIFs

Excel

SumIF CountIF

1

SumIFs, CountIFs, AverageIFs Excel 2003


Excel



Excel

Array IF


SumIFs, CountIFs,

AverageIFs
Array IF Array

Array IF
Array IF IF




True False
IF

True
False
Array IF
True
False
Array

True

Array


True/False
Sum Array Sum IF

Copyrightofwww.ExcelExpertTraining.com

131


Average Array Average IF

Array IF 2 2
Array
1. Array


True False
2. Array


(
Array


)

Array IF

Range ID a001 a002




Amount a001 Vlookup

Vlookup a001
Amount a001
a001
Array

Array IF Amount a001

Copyrightofwww.ExcelExpertTraining.com

132

1.







Num Name Insert
column C E

Check C3:C7 =Id=$G$3


2.
TRUE; FALSE; TRUE; FALSE; FALSE True
a001
3. E3:E7 =IF(Check,Amount,0) Check


0
True IF
Amount

4. E8 =SUM(E3:E7) 40
a001





a001


2

Copyrightofwww.ExcelExpertTraining.com

133

1. Id Array


True False


2. Amount Array

a001 G3




1. SUMIF =SUMIF(Id,$G$3,Amount)
2. Array SumIF { =SUM(IF(Id=$G$3,Amount))}
Ctrl+Shift+Enter { }
3. SumArray { =SUM((Id=$G$3)*Amount)}
Ctrl+Shift+Enter { }
4. SumProduct =SUMPRODUCT((Id=$G$3)*Amount)
Ctrl+Shift+Enter



1. Id Array


True False
a001
Array
{TRUE;FALSE;TRUE;FALSE;FALSE}
2. Amount Array


{10;20;30;40;50}
3.
Array {TRUE;FALSE;TRUE;FALSE;FALSE} Array
{10;20;30;40;50} Array

{10;FALSE;30;FALSE;FALSE}
4.

{10;FALSE;30;FALSE;FALSE} Sum
40







1. SUMIF

Copyrightofwww.ExcelExpertTraining.com

134

2. Array SumIF
Sum
Average, Count, Max, Min, Small


IF



{ =SUM(IF(Id=$G$3,Amount))} a001 40
{ =AVERAGE(IF(Id=$G$3,Amount))}
a001 20
{ =COUNT(IF(Id=$G$3,Amount))} a001 2
{ =MAX(IF(Id=$G$3,Amount))} a001 30
{ =MIN(IF(Id=$G$3,Amount))} a001 10

3. SumArray




IF


4. SumProduct
Ctrl+Shift+Enter

SumArray

True False
True False

Array
IF
Excel True 1 False

0

True False
True 1 True 1
False 0 False 0

Copyrightofwww.ExcelExpertTraining.com

135

B2 =TRUE()
B2
C2

=B2=1 False True
1
B2 C3:C8 B2 *1, /1,
+0, -0,
TRUE()
1
G2 =FALSE()
G2
H2

=G2=0 False False
0
G2 H3:H8 G2 *1, /1,
+0, -0,
TRUE()
0

Array True False Array





True False 1 0

1 0


Array

Copyrightofwww.ExcelExpertTraining.com

136

Array IF



Range

Amount Id a001 a002 (




)





G3 H3 110
1. {=SUM(IF(Id=G3, Amount, IF(Id=H3,Amount,0) ))}
Ctrl+Shift+Enter

{ }
IF(Id=G3, Amount, IF(Id=H3,Amount,0) )

F9 Array {10;20;30;0;50}
Amount

a001 a002 0
2. { =SUM( ((Id=G3)+(Id=H3)) *Amount) }
Ctrl+Shift+Enter

{ }
((Id=G3)+(Id=H3))

F9 Array {1;1;1;0;1} 1



(Id=G3) Array
{TRUE;FALSE;TRUE;FALSE;FALSE}
(Id=H3) Array
{FALSE;TRUE;FALSE;FALSE;TRUE} Array
{1;1;1;0;1}
Copyrightofwww.ExcelExpertTraining.com

137

{1;1;1;0;1} Array Amount {10;20;30;40;50}


Array {10;20;30;0;50} 110
3. =SUMPRODUCT( ((Id=G3)+(Id=H3)) *Amount)
{}

column

Column 1 Id a001 a002 4

Column 2 Id a001 a001 2



1 0
1, 0, 1, 0, 0

Column 3 Id a002 a002 2



1 0
0, 1, 0, 0, 1

Column 4
Column 2 Column 3
1, 1, 1, 0, 1 a001
a002
1

Column 5 Amount

Column 6
Column 4 Column 5
10, 20, 30, 0, 50 110

Copyrightofwww.ExcelExpertTraining.com

138

Array IF



Range

Amount Id a001
Name c (

)






G3 H3 30

1. { =SUM(IF(Id=G3, IF(Name=H3,Amount,0), 0 ))}
Ctrl+Shift+Enter

{ }
IF(Id=G3, IF(Name=H3,Amount,0), 0 )

F9 Array {0;0;30;0;0}
Amount
c 0

a001
2. { =SUM( (Id=G3)*(Name=H3) *Amount) }
Ctrl+Shift+Enter

{ }
(Id=G3)*(Name=H3)

F9 Array {0;0;1;0;0} 1

Copyrightofwww.ExcelExpertTraining.com

139



(Id=G3) Array
{TRUE;FALSE;TRUE;FALSE;FALSE} (Name=H3) Array
{FALSE;FALSE;TRUE;FALSE;FALSE} Array
{0;0;1;0;0}

{0;0;1;0;0} Array Amount {10;20;30;40;50}


Array {0;0;30;0;0} 30
3. =SUMPRODUCT( (Id=G3)*(Name=H3) *Amount)
{}



4. =SUMIFS(Amount,Id,G3,Name,H3)
Excel 2007

column

Column 1 Id a001 2

Column 2 Id a001 a001 2



1 0
1, 0, 1, 0, 0

Name
c 1
Column 3

Name c
Name c 1
Column 4

1 0
0, 0, 1, 0, 0

Copyrightofwww.ExcelExpertTraining.com

140

Column 5
Column 2 Column 4

0, 0, 1, 0, 0 a001
Name c
1

Column 6 Amount

Column 7
Column 5 Column 6
0, 0, 30, 0, 0 30

SumProduct
SumProduct
Array
Range










SumProduct Cost*Quantity

Total Column D
F2 =SUM(D3:D5)




Total Column D SumProduct


1. =SUMPRODUCT(Cost, Quantity)

comma ,
Range
2. =SUMPRODUCT(Cost*Quantity)
Range

F9

Copyrightofwww.ExcelExpertTraining.com

141


Array IF

Array IF 2 2
Array
1. Array


True False
2. Array


=SUMPRODUCT( (Id=G3)*(Name=H3) *Amount)

1. Array


True False (Id=G3)
(Name=H3)

True 1
False
0
2. Array

Amount

Amount



1. =SUMPRODUCT( (Id=G3)*(Name=H3) ) SumProduct
1 Array 1



2. =SUMPRODUCT( (Id=G3)*1, (Name=H3)*1)
3. =SUMPRODUCT( (Id=G3)/1, (Name=H3)/1)
4. =SUMPRODUCT( (Id=G3)+0, (Name=H3)+0)
5. =SUMPRODUCT( (Id=G3)-0, (Name=H3)-0)
6. =SUMPRODUCT( --(Id=G3), --(Name=H3) )

comma ,

SumProduct 2-6

True 1
False 0 True False

*1, /1, +0, -0,


SumProduct
()


Copyrightofwww.ExcelExpertTraining.com

142



SumProduct

comma ,

Array IF

= True False

Range


Range



Range









1

Copyrightofwww.ExcelExpertTraining.com

143


Excel


Excel

Excel


Excel

Excel
Excel


IF




IF








IF




=IF( 22.3-22.2=0.1, "", "")
!!! Excel 22.3-22.2

0.1


22.3-22.2
0.1
=22.3-22.2 F2 F9
Excel 0.100000000000001 0.1
0.100000000000001 0.1


Excel Excel


0.1 0.100000000000001
Excel









Copyrightofwww.ExcelExpertTraining.com

144

Excel (Format Number)




Excel 0.100000000000001

22.3-22.2

Excel






Excel
22.3-22.2


(Repeating Binary Number)


15 (Excel

Precision 15 )


22.3-22.2







IF, SumIF, VLookup, Match







Format
(



(
Excel Help)
1. =Round( , )
=Round(123.45,0) 123
=Round(123.45,1) 123.5
=Round(123.45,-1) 120
=Round(123.45,-2) 100
2. =Trunc( , )
=Trunc(123.45,0) 123
=Trunc(123.45,1) 123.4 Round
Copyrightofwww.ExcelExpertTraining.com

145

=Trunc(12
23.45,-1) 120
=Trunc(12
23.45,-2) 100
3. =Intt( )

(

)
=Int(1.23)) 1
=Int(-1.23
3) -2
4. =Mo
od(
,

)

=Mod(7,2)) 1 7/2 3 1/2


=Mod(7,4)) 3 7/4 1 3/4
=Mod(123
3.45,1)
.4
45 !!!




Column
n B

Column C

Column
n B



Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

146




Text

B2


Jan

Jan







Column C


Formula Bar
C2 Jan



C3 =C2+30
15/1/2010
C3 Copy


Format Cells
Column C [$-409]mmm 15/1/2010, 14/2/2010, 16/3/2010
Jan, Feb, Mar


C2 15




30






31 30 28-29

Copyrightofwww.ExcelExpertTraining.com

147



1.

14/2/2010 12:00


2.

Regional Setting
Regional Setting Thai
Windows

Regional Setting
USA
3. Regional Setting Thai ..


Format .. ..
14/2/2010 ( ..)


14/2/2553 Format [$-1070000]d/mm/yyyy
4.
/ // ..

: ::
5. .. 4
Enter
Excel
2
5.1. 00-29 .. 2000-2029
5.2. 30-99 .. 1930-1999
(
)


6.



Text

Excel

Regional Setting
Text
Date Serial Number Serial Number (SN)
7.

Excel 1/1/1900 0:00:00 SN=1 SN
14/2/2010

Format General ( Ctrl+Shift+ ~)


12:00:00 SN 40223.5
7.1. SN
7.2. SN
8. Excel
0:00:00-23:59:59 Format h:mm:ss
23:59:59
9.
0:00:00

9.1. Format [h]:mm:ss
24

Copyrightofwww.ExcelExpertTraining.com

148

9.2. Format [mm]:ss


60

9.3. Format [ss]
60

10. SN < 1 Format
SN >=1 Format

11.
14/2/2010 20:00

Excel SN




12. Format
12.1.

d dd

12.2.

ddd dddd

12.3.

m mm

12.4.

mmm mmmm

12.5.

yy yyyy

12.6.

h:mm:ss hh:mm:ss

12.7.

Locale [$-409] USA [$-1070000]








Regional Setting
Regional Setting USA



4/2/2001 4 2

2001



Regional Setting


2/4/2001






(Date


Serial Number SN)


Text
Left, Right, Mid


SN

Copyrightofwww.ExcelExpertTraining.com

149


SN

Now(),


SN Excel
Today(), Date(Year,Month,Day), Time(Hour,Minute,Second)
Day(SN),

SN

Hour(SN),
Month(SN), Year(SN), WeekDay(SN)

Minute(SN), Second(SN)



Serial Number



14 ..
30 45
2010 12
14/2/2010 12:30:45
1. =NOW()

14/2/2010
2. =Today()

3. =Date(2010,2,14) 14/2/2010
4. =Date( Year(Today()), Month(Today())+1, 0)

28/2/2010
5. =Time(12,30,45) 12:30:45
6. =Time(12,30,45)+1 36:30:45 Format [h]:mm:ss

Serial Number



A1
=NOW() 14/2/2010 12:30:45 (
SN
Format General A1 SN
40223.5213541667 Excel )
1. =Day(A1) 14
2. =Month(A1) 2
3. =Year(A1) 2010
Copyrightofwww.ExcelExpertTraining.com

150

1=Sunday, 2=Tuesday,7=Saturday
4. =WeekDay(A1)
5. =Hour(A1) 12
6. =Minute(A1) 30
7. =Second(A1) 45

Copyrightofwww.ExcelExpertTraining.com

151


Format Cells > Number


1. Excel
# 0
#

0 0
1.2 Format ##.## 1.2 Format

00.00 01.20 Format Excel

#,##0.00

0
Font
2. Format
# 0


[Red]


[ ]

[Color12]
[Colorn] n

3.
[ ]




[>=90]00000.00



[ ]


Format
90
00000.00

4. Format
Format
# 0
(0 . 00) %

4.1.

4.2.

Total 0.00
5.

0.00,, 123456789

123.46
123456789

6.
; 3
Format

;;;
6.1.
; Format Format


6.2.
; ; Format

Format

Copyrightofwww.ExcelExpertTraining.com

152




123, -123, 0, Hello

Format ;;;

Format 0.00 123.00, -123.00, 0.00, Hello

Format 0.00; 123.00, , 0.00, Hello

, 0.00, Hello
Format 0.00;[Red](0.00) 123.00, (123.00)

Format 0.00;; 123.00 Hello


0

Format 0.00;;; 123.00

Format 0.00;(0.00);; 123.00 (123.00)

Format Yes;No;Reject; Yes, No, Reject

Format Total 0 Baht. 00 Satang;;; Total 123 Baht. 00 Satang

Format 0.00_);(0.00);; 123.00 (123.00)

_) Format

)

Format

Format [>=90]A;[>=70]B;C


90 A

70 B

Format [=1]Yes;[=0]No;Reject Yes, No, Reject



1, 0,

Format 4;4;4;4
4

Format 0000 123 0123 (


0123 Format Cells > Number > Text


Text
)


Format

Alt 0177

Copyrightofwww.ExcelExpertTraining.com

153


Characterr Map

Start
charmap
c

S
> Run

Forma
at Cells > Number

Nu
umber





####
### Form at Cells >
Shriink to fit
Alignm
ment >

Excel
E
Font

Format
Fo
ormat






T
Text




&
A1 .15

.15

Profit
15.0% 2


Form
mat Cells > Number > Custom
Type
Profit 0.0
0%



=Profit &T
Text(A1,0.0%)

Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

154

Profit 15.0%


Text Round Text

=TEXT(123456789,"0.00,,") 123.46

123.46

Copyrightofwww.ExcelExpertTraining.com

155

Add-In
Add-In

.xla .xlam
Excel




Add-in


1.
Download Add-in

2.
Excel File > Options > Add-ins

Go
Add-ins Available

Excel
(Excel 2003 Tools > Add-Ins)
3. Browse Add-in


1 OK
Add-in

Add-ins Available
4.



Add-ins

Add-in

Excel Add-in
Add-in



Add-in


Expert2000.xla Add-in

Expert







=Fml(cell)

=Fmt(cell)
Format

Money.xla =Money(,
,

Add-in
=Money(1234.56,Dollar,Cent) One
)
Thousand Two Hundred Thirty Four Dollars and Fifty Six Cents




Excel
Fml

Expert2000.xla
Error #NAME!
Add-in Expert2000.xla

Copyrightofwww.ExcelExpertTraining.com

156






Error
F2
Enter

Copyrightofwww.ExcelExpertTraining.com

157

Function VBA

Function VBA

Function VBA
1. Visual Basic Editor Alt+F11
Insert > Module
2.



3. copy
Function End Function
4. paste copy
module

Function Function
5. Module

6. File > Save xlsm

Function VBA


Formulas > Insert Function

Fx Formula Bar VBA Function


Function category : User
Defined

Copyrightofwww.ExcelExpertTraining.com

158

Fu
unction GetFormat(ce
ell)
1

GetFormat = cell.Nu
umberForm
mat
En
nd Function

Fu
unction GetFormula(C
Cell)
GetFormula = Cell.F
Formula
En
nd Function
2
Fu
unction GetFormulaI((cell)
If VarType
e(cell) = 8 Then
GetFormu
ulaI = "'" & cell.form ula

Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

159

Else
GetFormulaI = cell.formula
End If
If cell.HasArray Then _
GetFormulaI = "{" & cell.formula & "}"
End Function

Function FormulaText(cell_ref)
'Allow formula to be updated if changes are made on the sheet
Application.Volatile
'Test for reference style in use
If Application.ReferenceStyle = xlA1 Then
3

'Set the return value of the function to the A1 style formula


FormulaText = cell_ref.Formula
Else ' xlR1C1 --Set the return value of the function to the R1C1 style
formula
FormulaText = cell_ref.FormulaR1C1
End If
End Function


R1C1

Function FUNCTION_DEF(FCELL As Variant)As Variant

Copyrightofwww.ExcelExpertTraining.com

160

'Let's make sure the function


'recalculates when required
Application.Volatile
'If the argument is not a range
'then return appropriate error.
If Not TypeName(FCELL) = "Range" Then
FUNCTION_DEF = CVErr(xlErrRef)
Exit Function
End If
'If the argument is not a single
'cell then return appropriate error.
If Not FCELL.Cells.Count = 1 Then
FUNCTION_DEF = CVErr(xlErrRef)
Exit Function
End If
'If the argument cell contains no
'formula, then just return its value
If Not FCELL.HasFormula Then
FUNCTION_DEF = FCELL.Value
Exit Function
End If
'Find out the format of the formula
'we need to return...
Select Case Application.ReferenceStyle
Case xlA1

Copyrightofwww.ExcelExpertTraining.com

161

FUNCTION_DEF = FCELL.Formula
Case xlR1C1
FUNCTION_DEF = FCELL.FormulaR1C1
End Select
'Finally check whether we are looking at a cell
'containing an array function.
If FCELL.HasArray Then _
FUNCTION_DEF = "{" & FUNCTION_DEF & "}"
End Function

Option Explicit
Function DATEDIFF(d1, d2) As Variant
Dim YearDiff As Integer
Dim MonthDiff As Integer
Dim DayDiff As Integer
Dim temp As Date
5
' Swap arguments, if necessary
If d1 > d2 Then
temp = d1
d1 = d2
d2 = temp
End If

Copyrightofwww.ExcelExpertTraining.com

162

' Do the year part


YearDiff = Year(d2) - Year(d1)
If DateSerial(Year(d2), Month(d1), Day(d1)) > d2 _
Then YearDiff = YearDiff - 1
' Do the month part
If Month(d2) > Month(d1) Then
If Day(d2) >= Day(d1) Then
MonthDiff = Month(d2) - Month(d1)
Else
MonthDiff = Month(d2) - Month(d1) - 1
End If
Else
If Day(d2) >= Day(d1) Then
MonthDiff = Month(d2) - Month(d1) + 12
If MonthDiff = 12 Then MonthDiff = 0
Else
MonthDiff = Month(d2) - Month(d1) + 11
End If
End If
' Do the day part
If Day(d2) >= Day(d1) Then
DayDiff = Day(d2) - Day(d1)
Else
DayDiff = Day(DateSerial(Year(d1), _
Month(d1) + 1, 1) - 1) - Day(d1) + Day(d2)
End If
' Create the variant array to be returned

Copyrightofwww.ExcelExpertTraining.com

163

DATEDIFF = Array(YearDiff, MonthDiff, DayDiff)


End Function



www.j-walk.com\ss\excel\tips\tip55.htm

Function Age(TheDate As Double) As String


Age = _
CStr(Evaluate("=DATEDIF(" & TheDate & "," & CDbl(Now) & ",""y"")"))
& " years " & _
6

CStr(Evaluate("=DATEDIF(" & TheDate & "," & CDbl(Now) &


",""ym"")")) & " months " & _
CStr(Evaluate("=DATEDIF(" & TheDate & "," & CDbl(Now) &
",""md"")")) & " days"
End Function

Function OrdDate(arg)
dd = Day(arg)
mmmm = Format(arg, "mmmm")

'*Corrected*

7
yyyy = Year(arg)
Select Case Day(arg)
Case 1, 21, 31

Copyrightofwww.ExcelExpertTraining.com

164

OrdDate = dd & "st " & mmmm & ", " & yyyy
Case 2, 22
OrdDate = dd & "nd " & mmmm & ", " & yyyy
Case 3, 23
OrdDate = dd & "rd " & mmmm & ", " & yyyy
Case 4 To 20, 24 To 30
OrdDate = dd & "th " & mmmm & ", " & yyyy
End Select
End Function

st nd rd th

Function SheetName() As String


8

SheetName = Application.Caller.Parent.Name 'in XL97


End Function

sheet

Function CellType(c)
' Returns the cell type of the upper left
9
' cell in a range
Application.Volatile

Copyrightofwww.ExcelExpertTraining.com

165

Set c = c.Range("A1")
Select Case True
Case IsEmpty(c): CellType = "Blank"
Case Application.IsText(c): CellType = "Text"
Case Application.IsLogical(c): CellType = "Logical"
Case Application.IsErr(c): CellType = "Error"
Case IsDate(c): CellType = "Date"
Case InStr(1, c.Text, ":") <> 0: CellType = "Time"
Case IsNumeric(c): CellType = "Value"
End Select
End Function

Function CellValue(c) As Double


'John Walkenbach 2001-04-25
10

'

misc returns number part

CellValue = Val(c)
End Function

Copyrightofwww.ExcelExpertTraining.com

166

Function HasFormula(cell)
11

HasFormula = cell.HasFormula
End Function

Function UseFormula(cell)
'-- Usage: Not recommended, see notes
UseFormula = Application.Evaluate(cell.formula)
End Function
Function UseFormula2(cell)
'Documented in
http://www.geocities.com/davemcritchie/excel/formula.htm
' UseFormula Jul 20, 1998, UseFormula2 Jun 13, 2000
12

'Application.Volatile = True -- DO NOT DO THIS


If Trim(cell.Value) = "" Then
UseFormula2 = ""
Exit Function
ElseIf Left(cell.Value, 1) = "=" Then
UseFormula2 = Application.Evaluate(cell.Formula)
Exit Function
Else

Copyrightofwww.ExcelExpertTraining.com

167

UseFormula2 = "'#bad formula"


End If
End Function

Function fontinfo(cell As Range) As String


fontinfo = cell.FONT.Name & " -- " & cell.FONT.Size
If Left(cell.FONT.FontStyle, 7) = "Regular" Then
fontinfo = Trim(fontinfo & Mid(cell.FONT.FontStyle, 8, 100))
13
Else
fontinfo = Trim(fontinfo & " " & cell.FONT.FontStyle)
End If
End Function

font

Function SumByColor(InputRange As Range, ColorRange As Range) As


Double
14

Dim cl As Range, TempSum As Double, ColorIndex As Integer


ColorIndex = ColorRange.Cells(1, 1).Interior.ColorIndex
TempSum = 0
On Error Resume Next ' ignore cells without values

Copyrightofwww.ExcelExpertTraining.com

168

For Each cl In InputRange.Cells


If cl.Interior.ColorIndex = ColorIndex Then TempSum = TempSum +
cl.Value
Next cl
On Error GoTo 0
Set cl = Nothing
SumByColor = TempSum
End Function

www.erlandsendata.no

Function CountByColor(InputRange As Range, ColorRange as Range) As


Long
Dim cl As Range, TempCount As Long, ColorIndex As Integer
ColorIndex = ColorRange.Cells(1, 1).Interior.ColorIndex
TempCount = 0
For Each cl In InputRange.Cells
15
If cl.Interior.ColorIndex = ColorIndex Then TempCount =
TempCount + 1
Next cl
Set cl = Nothing
CountByColor = TempCount
End Function

Copyrightofwww.ExcelExpertTraining.com

169

Function WEEKNR(InputDate As Long) As Integer


Dim A As Integer, B As Integer, C As Long, D As Integer
WEEKNR = 0
If InputDate < 1 Then Exit Function
A = Weekday(InputDate, vbSunday)
16
B = Year(InputDate + ((8 - A) Mod 7) - 3)
C = CDate("1.1." & B)
D = (Weekday(C, vbSunday) + 1) Mod 7
WEEKNR = Int((InputDate - C - 3 + D) / 7) + 1
End Function

www.erlandsendata.no

Function UniqueItem(InputRange As Range, ItemNo As Long) As Variant


Dim cl As Range, cUnique As New Collection, cValue As Variant
17

Application.Volatile
On Error Resume Next
For Each cl In InputRange

Copyrightofwww.ExcelExpertTraining.com

170

If cl.Formula <> "" Then


cUnique.Add cl.Value, CStr(cl.Value)
End If
Next cl
UniqueItem = ""
If ItemNo = 0 Then
UniqueItem = cUnique.Count
Else
If ItemNo <= cUnique.Count Then
UniqueItem = cUnique(ItemNo)
End If
End If
On Error GoTo 0
End Function

unique values
=UniqueItem(A1:A100,2) the 2nd unique value
=UniqueItem(A1:A100,0) unique values

18 Function INDEXN(InputRange As Range, N As Integer) As Variant

Copyrightofwww.ExcelExpertTraining.com

171

' returns every N-th item from InputRange


' select the desired target range for the function and
' enter as an array function with Ctrl+Shift+Enter.
Dim ItemList() As Variant, c As Range, i As Long, iCount As Long
i=0
iCount = 0
ReDim ItemList(1 To InputRange.Cells.Count \ N)
For Each c In InputRange
i=i+1
If i Mod N = 0 Then
iCount = iCount + 1
On Error Resume Next
ItemList(iCount) = c.Value
On Error GoTo 0
End If
Next c
INDEXN = ItemList
If InputRange.Rows.Count >= InputRange.Columns.Count Then
INDEXN = Application.WorksheetFunction.Transpose(INDEXN)

Copyrightofwww.ExcelExpertTraining.com

172

End If
Erase ItemList
End Function

Sub FindUniqueValues(SourceRange As Range, TargetCell As Range)

19

SourceRange.AdvancedFilter Action:=xlFilterCopy,
CopyToRange:=TargetCell, Unique:=True
End Sub

unique items

Function TimeInterval(StartTime As Double, EndTime As Double, _


LowerLimit As Double, UpperLimit As Double) As Double
' returns EndTime-StartTime limited by LowerLimit and UpperLimit
TimeInterval = 0
20
If StartTime > EndTime Then Exit Function
If StartTime > UpperLimit Then Exit Function
If EndTime < LowerLimit Then Exit Function
If StartTime < LowerLimit Then StartTime = LowerLimit

Copyrightofwww.ExcelExpertTraining.com

173

If EndTime > UpperLimit Then EndTime = UpperLimit


TimeInterval = EndTime - StartTime
End Function

Option Explicit
'****************
' Main Function *
'****************
Function BahtEng(ByVal MyNumber)
Dim Baht, Satang, Temp
Dim DecimalPlace, Count
ReDim Place(9) As String
21

Place(2) = " Thousand "


Place(3) = " Million "
Place(4) = " Billion "
Place(5) = " Trillion "
' String representation of amount
MyNumber = Trim(Str(MyNumber))
' Position of decimal place 0 if none
DecimalPlace = InStr(MyNumber, ".")
'Convert Satang and set MyNumber to Baht amount
If DecimalPlace > 0 Then

Copyrightofwww.ExcelExpertTraining.com

174

Satang = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & "00", 2))


MyNumber = Trim(Left(MyNumber, DecimalPlace - 1))
End If
Count = 1
Do While MyNumber <> ""
Temp = GetHundreds(Right(MyNumber, 3))
If Temp <> "" Then Baht = Temp & Place(Count) & Baht
If Len(MyNumber) > 3 Then
MyNumber = Left(MyNumber, Len(MyNumber) - 3)
Else
MyNumber = ""
End If
Count = Count + 1
Loop
Select Case Baht
Case ""
Baht = "No Baht"
Case "One"
Baht = "One Baht"
Case Else
Baht = Baht & " Baht"
End Select
Select Case Satang
Case ""
Satang = " and No Satang"
Case "One"
Satang = " and One Satang"

Copyrightofwww.ExcelExpertTraining.com

175

Case Else
Satang = " and " & Satang & " Satang"
End Select
BahtEng = Baht & Satang
End Function
'*******************************************
' Converts a number from 100-999 into text *
'*******************************************
Private Function GetHundreds(ByVal MyNumber)
Dim Result As String
If Val(MyNumber) = 0 Then Exit Function
MyNumber = Right("000" & MyNumber, 3)
'Convert the hundreds place
If Mid(MyNumber, 1, 1) <> "0" Then
Result = GetDigit(Mid(MyNumber, 1, 1)) & " Hundred "
End If
'Convert the tens and ones place
If Mid(MyNumber, 2, 1) <> "0" Then
Result = Result & GetTens(Mid(MyNumber, 2))
Else
Result = Result & GetDigit(Mid(MyNumber, 3))
End If
GetHundreds = Result
End Function

Copyrightofwww.ExcelExpertTraining.com

176

'*********************************************
' Converts a number from 10 to 99 into text. *
'*********************************************
Private Function GetTens(TensText)
Dim Result As String
Result = "" 'null out the temporary function value
If Val(Left(TensText, 1)) = 1 Then ' If value between 10-19
Select Case Val(TensText)
Case 10: Result = "Ten"
Case 11: Result = "Eleven"
Case 12: Result = "Twelve"
Case 13: Result = "Thirteen"
Case 14: Result = "Fourteen"
Case 15: Result = "Fifteen"
Case 16: Result = "Sixteen"
Case 17: Result = "Seventeen"
Case 18: Result = "Eighteen"
Case 19: Result = "Nineteen"
Case Else
End Select
Else ' If value between 20-99
Select Case Val(Left(TensText, 1))
Case 2: Result = "Twenty "
Case 3: Result = "Thirty "
Case 4: Result = "Forty "
Case 5: Result = "Fifty "
Case 6: Result = "Sixty "
Case 7: Result = "Seventy "

Copyrightofwww.ExcelExpertTraining.com

177

Case 8: Result = "Eighty "


Case 9: Result = "Ninety "
Case Else
End Select
Result = Result & GetDigit _
(Right(TensText, 1)) 'Retrieve ones place
End If
GetTens = Result
End Function
'*******************************************
' Converts a number from 1 to 9 into text. *
'*******************************************
Private Function GetDigit(Digit)
Select Case Val(Digit)
Case 1: GetDigit = "One"
Case 2: GetDigit = "Two"
Case 3: GetDigit = "Three"
Case 4: GetDigit = "Four"
Case 5: GetDigit = "Five"
Case 6: GetDigit = "Six"
Case 7: GetDigit = "Seven"
Case 8: GetDigit = "Eight"
Case 9: GetDigit = "Nine"
Case Else: GetDigit = ""
End Select
End Function

Copyrightofwww.ExcelExpertTraining.com

178

Option Explicit
'****************
' Main Function *
'****************
Function BahtOnly(ByVal MyNumber)
Dim Baht, Satang, Temp
Dim DecimalPlace, Count
ReDim Place(9) As String
Place(2) = " Thousand "
Place(3) = " Million "
Place(4) = " Billion "
Place(5) = " Trillion "
22
' String representation of amount
MyNumber = Trim(Str(MyNumber))
' Position of decimal place 0 if none
DecimalPlace = InStr(MyNumber, ".")
'Convert Satang and set MyNumber to Baht amount
If DecimalPlace > 0 Then
Satang = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & "00", 2))
MyNumber = Trim(Left(MyNumber, DecimalPlace - 1))
End If
Count = 1
Do While MyNumber <> ""
Temp = GetHundreds(Right(MyNumber, 3))

Copyrightofwww.ExcelExpertTraining.com

179

If Temp <> "" Then Baht = Temp & Place(Count) & Baht
If Len(MyNumber) > 3 Then
MyNumber = Left(MyNumber, Len(MyNumber) - 3)
Else
MyNumber = ""
End If
Count = Count + 1
Loop
Select Case Baht
Case ""
Baht = "No Baht"
Case "One"
Baht = "One Baht"
Case Else
Baht = Baht & " Baht"
End Select
Select Case Satang
Case ""
Satang = " Only"
Case "One"
Satang = " and One Satang"
Case Else
Satang = " and " & Satang & " Satang"
End Select
BahtOnly = Baht & Satang
End Function

Copyrightofwww.ExcelExpertTraining.com

180

'*******************************************
' Converts a number from 100-999 into text *
'*******************************************
Private Function GetHundreds(ByVal MyNumber)
Dim Result As String
If Val(MyNumber) = 0 Then Exit Function
MyNumber = Right("000" & MyNumber, 3)
'Convert the hundreds place
If Mid(MyNumber, 1, 1) <> "0" Then
Result = GetDigit(Mid(MyNumber, 1, 1)) & " Hundred "
End If
'Convert the tens and ones place
If Mid(MyNumber, 2, 1) <> "0" Then
Result = Result & GetTens(Mid(MyNumber, 2))
Else
Result = Result & GetDigit(Mid(MyNumber, 3))
End If
GetHundreds = Result
End Function
'*********************************************
' Converts a number from 10 to 99 into text. *
'*********************************************
Private Function GetTens(TensText)
Dim Result As String

Copyrightofwww.ExcelExpertTraining.com

181

Result = "" 'null out the temporary function value


If Val(Left(TensText, 1)) = 1 Then ' If value between 10-19
Select Case Val(TensText)
Case 10: Result = "Ten"
Case 11: Result = "Eleven"
Case 12: Result = "Twelve"
Case 13: Result = "Thirteen"
Case 14: Result = "Fourteen"
Case 15: Result = "Fifteen"
Case 16: Result = "Sixteen"
Case 17: Result = "Seventeen"
Case 18: Result = "Eighteen"
Case 19: Result = "Nineteen"
Case Else
End Select
Else ' If value between 20-99
Select Case Val(Left(TensText, 1))
Case 2: Result = "Twenty "
Case 3: Result = "Thirty "
Case 4: Result = "Forty "
Case 5: Result = "Fifty "
Case 6: Result = "Sixty "
Case 7: Result = "Seventy "
Case 8: Result = "Eighty "
Case 9: Result = "Ninety "
Case Else
End Select
Result = Result & GetDigit _
(Right(TensText, 1)) 'Retrieve ones place
End If

Copyrightofwww.ExcelExpertTraining.com

182

GetTens = Result
End Function
'*******************************************
' Converts a number from 1 to 9 into text. *
'*******************************************
Private Function GetDigit(Digit)
Select Case Val(Digit)
Case 1: GetDigit = "One"
Case 2: GetDigit = "Two"
Case 3: GetDigit = "Three"
Case 4: GetDigit = "Four"
Case 5: GetDigit = "Five"
Case 6: GetDigit = "Six"
Case 7: GetDigit = "Seven"
Case 8: GetDigit = "Eight"
Case 9: GetDigit = "Nine"
Case Else: GetDigit = ""
End Select
End Function

Option Explicit

23

'****************
' Main Function *
'****************
Function Money(ByVal MyNumber, UnitName1, UnitName2)

Copyrightofwww.ExcelExpertTraining.com

183

Dim KeyUnit1, KeyUnit2, Temp


Dim DecimalPlace, Count
ReDim Place(9) As String
Place(2) = " Thousand "
Place(3) = " Million "
Place(4) = " Billion "
Place(5) = " Trillion "
' String representation of amount
MyNumber = Trim(Str(MyNumber))
' Position of decimal place 0 if none
DecimalPlace = InStr(MyNumber, ".")
'Convert KeyUnit2 and set MyNumber to KeyUnit1 amount
If DecimalPlace > 0 Then
KeyUnit2 = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & "00", 2))
MyNumber = Trim(Left(MyNumber, DecimalPlace - 1))
End If
Count = 1
Do While MyNumber <> ""
Temp = GetHundreds(Right(MyNumber, 3))
If Temp <> "" Then KeyUnit1 = Temp & Place(Count) & KeyUnit1
If Len(MyNumber) > 3 Then
MyNumber = Left(MyNumber, Len(MyNumber) - 3)
Else
MyNumber = ""
End If
Count = Count + 1

Copyrightofwww.ExcelExpertTraining.com

184

Loop
Select Case KeyUnit1
Case ""
KeyUnit1 = "No " & UnitName1
Case "One"
KeyUnit1 = "One " & UnitName1
Case Else
KeyUnit1 = KeyUnit1 & " " & UnitName1 & "s"
End Select
Select Case KeyUnit2
Case ""
KeyUnit2 = " Only"
Case "One"
KeyUnit2 = " and One " & " " & UnitName2
Case Else
KeyUnit2 = " and " & KeyUnit2 & " " & UnitName2 & "s"
End Select
Money = KeyUnit1 & KeyUnit2
End Function
'*******************************************
' Converts a number from 100-999 into text *
'*******************************************
Private Function GetHundreds(ByVal MyNumber)
Dim Result As String
If Val(MyNumber) = 0 Then Exit Function

Copyrightofwww.ExcelExpertTraining.com

185

MyNumber = Right("000" & MyNumber, 3)


'Convert the hundreds place
If Mid(MyNumber, 1, 1) <> "0" Then
Result = GetDigit(Mid(MyNumber, 1, 1)) & " Hundred "
End If
'Convert the tens and ones place
If Mid(MyNumber, 2, 1) <> "0" Then
Result = Result & GetTens(Mid(MyNumber, 2))
Else
Result = Result & GetDigit(Mid(MyNumber, 3))
End If
GetHundreds = Result
End Function
'*********************************************
' Converts a number from 10 to 99 into text. *
'*********************************************
Private Function GetTens(TensText)
Dim Result As String
Result = "" 'null out the temporary function value
If Val(Left(TensText, 1)) = 1 Then ' If value between 10-19
Select Case Val(TensText)
Case 10: Result = "Ten"
Case 11: Result = "Eleven"
Case 12: Result = "Twelve"
Case 13: Result = "Thirteen"

Copyrightofwww.ExcelExpertTraining.com

186

Case 14: Result = "Fourteen"


Case 15: Result = "Fifteen"
Case 16: Result = "Sixteen"
Case 17: Result = "Seventeen"
Case 18: Result = "Eighteen"
Case 19: Result = "Nineteen"
Case Else
End Select
Else ' If value between 20-99
Select Case Val(Left(TensText, 1))
Case 2: Result = "Twenty "
Case 3: Result = "Thirty "
Case 4: Result = "Forty "
Case 5: Result = "Fifty "
Case 6: Result = "Sixty "
Case 7: Result = "Seventy "
Case 8: Result = "Eighty "
Case 9: Result = "Ninety "
Case Else
End Select
Result = Result & GetDigit _
(Right(TensText, 1)) 'Retrieve ones place
End If
GetTens = Result
End Function
'*******************************************
' Converts a number from 1 to 9 into text. *
'*******************************************
Private Function GetDigit(Digit)

Copyrightofwww.ExcelExpertTraining.com

187

Select Case Val(Digit)


Case 1: GetDigit = "One"
Case 2: GetDigit = "Two"
Case 3: GetDigit = "Three"
Case 4: GetDigit = "Four"
Case 5: GetDigit = "Five"
Case 6: GetDigit = "Six"
Case 7: GetDigit = "Seven"
Case 8: GetDigit = "Eight"
Case 9: GetDigit = "Nine"
Case Else: GetDigit = ""
End Select
End Function

Option Explicit
'****************
' Main Function *
'****************
Function UnitText(ByVal MyNumber, UnitName1, UnitName2)
24 Dim KeyUnit1, KeyUnit2, Temp
Dim DecimalPlace, Count
ReDim Place(9) As String
Place(2) = " Thousand "
Place(3) = " Million "
Place(4) = " Billion "

Copyrightofwww.ExcelExpertTraining.com

188

Place(5) = " Trillion "


' String representation of amount
MyNumber = Trim(Str(MyNumber))
' Position of decimal place 0 if none
DecimalPlace = InStr(MyNumber, ".")
'Convert KeyUnit2 and set MyNumber to KeyUnit1 amount
If DecimalPlace > 0 Then
KeyUnit2 = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & "00", 2))
MyNumber = Trim(Left(MyNumber, DecimalPlace - 1))
End If
Count = 1
Do While MyNumber <> ""
Temp = GetHundreds(Right(MyNumber, 3))
If Temp <> "" Then KeyUnit1 = Temp & Place(Count) & KeyUnit1
If Len(MyNumber) > 3 Then
MyNumber = Left(MyNumber, Len(MyNumber) - 3)
Else
MyNumber = ""
End If
Count = Count + 1
Loop
Select Case KeyUnit1
Case ""
KeyUnit1 = "No " & UnitName1
Case "One"
KeyUnit1 = "One " & UnitName1

Copyrightofwww.ExcelExpertTraining.com

189

Case Else
KeyUnit1 = KeyUnit1 & " " & UnitName1 & "" 'without s
End Select
Select Case KeyUnit2
Case ""
KeyUnit2 = " Only"
Case "One"
KeyUnit2 = " and One " & " " & UnitName2
Case Else
KeyUnit2 = " and " & KeyUnit2 & " " & UnitName2 & "" 'without s
End Select
UnitText = KeyUnit1 & KeyUnit2
End Function
'*******************************************
' Converts a number from 100-999 into text *
'*******************************************
Private Function GetHundreds(ByVal MyNumber)
Dim Result As String
If Val(MyNumber) = 0 Then Exit Function
MyNumber = Right("000" & MyNumber, 3)
'Convert the hundreds place
If Mid(MyNumber, 1, 1) <> "0" Then
Result = GetDigit(Mid(MyNumber, 1, 1)) & " Hundred "
End If

Copyrightofwww.ExcelExpertTraining.com

190

'Convert the tens and ones place


If Mid(MyNumber, 2, 1) <> "0" Then
Result = Result & GetTens(Mid(MyNumber, 2))
Else
Result = Result & GetDigit(Mid(MyNumber, 3))
End If
GetHundreds = Result
End Function
'*********************************************
' Converts a number from 10 to 99 into text. *
'*********************************************
Private Function GetTens(TensText)
Dim Result As String
Result = "" 'null out the temporary function value
If Val(Left(TensText, 1)) = 1 Then ' If value between 10-19
Select Case Val(TensText)
Case 10: Result = "Ten"
Case 11: Result = "Eleven"
Case 12: Result = "Twelve"
Case 13: Result = "Thirteen"
Case 14: Result = "Fourteen"
Case 15: Result = "Fifteen"
Case 16: Result = "Sixteen"
Case 17: Result = "Seventeen"
Case 18: Result = "Eighteen"
Case 19: Result = "Nineteen"
Case Else

Copyrightofwww.ExcelExpertTraining.com

191

End Select
Else ' If value between 20-99
Select Case Val(Left(TensText, 1))
Case 2: Result = "Twenty "
Case 3: Result = "Thirty "
Case 4: Result = "Forty "
Case 5: Result = "Fifty "
Case 6: Result = "Sixty "
Case 7: Result = "Seventy "
Case 8: Result = "Eighty "
Case 9: Result = "Ninety "
Case Else
End Select
Result = Result & GetDigit _
(Right(TensText, 1)) 'Retrieve ones place
End If
GetTens = Result
End Function
'*******************************************
' Converts a number from 1 to 9 into text. *
'*******************************************
Private Function GetDigit(Digit)
Select Case Val(Digit)
Case 1: GetDigit = "One"
Case 2: GetDigit = "Two"
Case 3: GetDigit = "Three"
Case 4: GetDigit = "Four"
Case 5: GetDigit = "Five"
Case 6: GetDigit = "Six"

Copyrightofwww.ExcelExpertTraining.com

192

Case 7: GetDigit = "Seven"


Case 8: GetDigit = "Eight"
Case 9: GetDigit = "Nine"
Case Else: GetDigit = ""
End Select
End Function

Option Explicit
Function NetYMD(Day1 As Date, Day2 As Date) As String
Dim years, months, days, m
years = Year(Day2) - Year(Day1)
If Month(Day1) > Month(Day2) Then
years = years - 1
End If
25

If Month(Day2) < Month(Day1) Then


months = 12 - Month(Day1) + Month(Day2)
Else
months = Month(Day2) - Month(Day1)
End If
If Day(Day2) < Day(Day1) Then
months = months - 1
If Month(Day2) = Month(Day1) Then
years = years - 1

Copyrightofwww.ExcelExpertTraining.com

193

months = 11
End If
End If
days = Day(Day2) - Day(Day1)
If days < 0 Then
m = CInt(Month(Day2)) - 1
If m = 0 Then m = 12
Select Case m
Case 1, 3, 5, 7, 8, 10, 12
days = 31 + days
Case 4, 6, 9, 11
days = 30 + days
Case 2
If (Year(Day2) Mod 4 = 0 And Year(Day2) _
Mod 100 <> 0) Or Year(Day2) Mod 400 = 0 Then
days = 29 + days
Else
days = 28 + days
End If
End Select
End If
NetYMD = CStr(years) + " years " + CStr(months) _
+ " months " + CStr(days) + " days "
End Function
Function NetYear(Day1 As Date, Day2 As Date) As String
Dim years, months, days, m
years = Year(Day2) - Year(Day1)

Copyrightofwww.ExcelExpertTraining.com

194

If Month(Day1) > Month(Day2) Then


years = years - 1
End If
NetYear = CStr(years)
End Function
Function NetMonth(Day1 As Date, Day2 As Date) As String
Dim years, months, days, m
If Month(Day2) < Month(Day1) Then
months = 12 - Month(Day1) + Month(Day2)
Else
months = Month(Day2) - Month(Day1)
End If
If Day(Day2) < Day(Day1) Then
months = months - 1
If Month(Day2) = Month(Day1) Then
years = years - 1
months = 11
End If
End If
NetMonth = CStr(months)
End Function
Function NetDay(Day1 As Date, Day2 As Date) As String
Dim years, months, days, m

Copyrightofwww.ExcelExpertTraining.com

195

days = Day(Day2) - Day(Day1)


If days < 0 Then
m = CInt(Month(Day2)) - 1
If m = 0 Then m = 12
Select Case m
Case 1, 3, 5, 7, 8, 10, 12
days = 31 + days
Case 4, 6, 9, 11
days = 30 + days
Case 2
If (Year(Day2) Mod 4 = 0 And Year(Day2) _
Mod 100 <> 0) Or Year(Day2) Mod 400 = 0 Then
days = 29 + days
Else
days = 28 + days
End If
End Select
End If
NetDay = CStr(days)
End Function

26

Function PersonalTax(TaxableIncome)
Const UpperRange0 = 50000

Copyrightofwww.ExcelExpertTraining.com

196

Const UpperRange1 = 100000


Const UpperRange2 = 500000
Const UpperRange3 = 1000000
Const UpperRange4 = 4000000
Const TaxRate0 = 0
Const TaxRate1 = 0.05
Const TaxRate2 = 0.1
Const TaxRate3 = 0.2
Const TaxRate4 = 0.3
Const TaxRate5 = 0.37
Const TotalTaxPay0 = 0
Const TotalTaxPay1 = 2500
Const TotalTaxPay2 = 42500
Const TotalTaxPay3 = 142500
Const TotalTaxPay4 = 1042500
Select Case TaxableIncome
Case Is >= UpperRange4
PersonalTax = TotalTaxPay4 + _
(TaxRate5 * (TaxableIncome - UpperRange4))
Case Is >= UpperRange3
PersonalTax = TotalTaxPay3 + _
(TaxRate4 * (TaxableIncome - UpperRange3))
Case Is >= UpperRange2
PersonalTax = TotalTaxPay2 + _
(TaxRate3 * (TaxableIncome - UpperRange2))
Case Is >= UpperRange1
PersonalTax = TotalTaxPay1 + _
(TaxRate2 * (TaxableIncome - UpperRange1))
Case Is >= UpperRange0
PersonalTax = TotalTaxPay0 + _

Copyrightofwww.ExcelExpertTraining.com

197

(TaxRate1 * (TaxableIncome - UpperRange0))


Case Is < UpperRange0
PersonalTax = TaxRate0 * TaxableIncome
End Select
End Function

Public Function SigFig(X As Variant, SigFigs As Integer) As Variant


'Rounds X to Sigfigs significant figures
'Many thanks to John N. of Locum Destination Consulting for sharing his
SigFig() function for rounding to significant figures.
'http://www.pcqna.com/Excel_Rounding.htm
Dim Powers As Double, Sign As Long
On Error GoTo ErrHandler
27

If SigFigs < 1 Then GoTo ErrHandler


Sign = Sgn(X)
X = Abs(X)
Powers = 10 ^ (Int(Log(X) / Log(10#)) + 1)
'Application.Round() in next line is an Excel function; adjust as needed
SigFig = Sign * Application.Round(X / Powers, SigFigs) * Powers
Exit Function
ErrHandler:
SigFig = CVErr(xlErrValue)
End Function

Copyrightofwww.ExcelExpertTraining.com

198

'Further developed by Somkiat Foongkiat


'http://xls.i.am
'Excel Expert Training
Public Function SigFigDown(X As Variant, SigFigs As Integer) As Variant
Dim Powers As Double, Sign As Long
On Error GoTo ErrHandler
If SigFigs < 1 Then GoTo ErrHandler
Sign = Sgn(X)
X = Abs(X)
Powers = 10 ^ (Int(Log(X) / Log(10#)) + 1)
SigFigDown = Sign * Application.RoundDown(X / Powers, SigFigs) *
Powers
Exit Function
ErrHandler:
SigFigDown = CVErr(xlErrValue)
End Function

Public Function SigFigUp(X As Variant, SigFigs As Integer) As Variant


Dim Powers As Double, Sign As Long
On Error GoTo ErrHandler
If SigFigs < 1 Then GoTo ErrHandler
Sign = Sgn(X)
X = Abs(X)
Powers = 10 ^ (Int(Log(X) / Log(10#)) + 1)
SigFigUp = Sign * Application.RoundUp(X / Powers, SigFigs) * Powers
Exit Function
ErrHandler:
SigFigUp = CVErr(xlErrValue)

Copyrightofwww.ExcelExpertTraining.com

199

End Function

Public Function PowerNum(X As Variant) As Double


X = Abs(X)
PowerNum = (Int(Log(X) / Log(10#)) + 1)
End Function
Public Function RoundSP(Num As Variant, NumDigits As Integer) As
Variant
Dim PowersX As Double, PowersZ As Double, Sign As Long
Dim X1 As Variant, X2 As Variant, X3 As Variant
Dim Y1 As Variant, Y2 As Variant
Dim Z1 As Variant, Z2 As Variant, Z3 As Variant
On Error GoTo ZeroHandler
Sign = Sgn(Num)
Num = Abs(Num)
X1 = Application.RoundDown(Num, NumDigits + 1)
PowersX = 10 ^ (Int(Log(X1) / Log(10#)) + 1)
X2 = X1 / PowersX
X3 = Right(X2, 1) '
Y1 = Application.RoundDown(Num, NumDigits + 1)
Y2 = Num - Y1 '

Z1 = Application.RoundDown(Num, NumDigits)
PowersZ = 10 ^ (Int(Log(Z1) / Log(10#)) + 1)
Z2 = Z1 / PowersZ

Copyrightofwww.ExcelExpertTraining.com

200

Z3 = Right(Z2, 1) '

If (X3 > 5) _
Or ((X3 = 5) And (Y2 <> 0)) _
Or ((X3 = 5) And (Z3 - Application.Odd(Z3)) = 0) _
Then
RoundSP = Sign * Application.Round(Num, NumDigits)
Else
RoundSP = Sign * Application.RoundDown(Num, NumDigits)
End If
Exit Function
ZeroHandler:
RoundSP = Sign * Application.Round(Num, NumDigits)
End Function

Public Function SigFigSP(X As Variant, SigFigs As Integer) As Variant


Dim Powers As Double, Sign As Long
On Error GoTo ErrHandler
If SigFigs < 1 Then GoTo ErrHandler
Sign = Sgn(X)
X = Abs(X)
Powers = 10 ^ (Int(Log(X) / Log(10#)) + 1)
SigFigSP = Sign * RoundSP(X / Powers, SigFigs) * Powers
Exit Function
ErrHandler:
SigFigSP = CVErr(xlErrValue)
End Function
Public Function CountDecimal(X As Variant) As Integer

Copyrightofwww.ExcelExpertTraining.com

201

X = Abs(X)
If X < 1 Then
CountDecimal = Len(X) - Len(Int(X))
Else
CountDecimal = Application.Max(0, Len(X) - Len(Int(X)) - 1)
End If
End Function
Public Function CountInteger(X As Variant) As Integer
X = Abs(X)
If Int(X) = 0 Then
CountInteger = 0
Else
CountInteger = Len(Int(X))
End If
End Function
Public Function CountSF(X As Variant) As Integer
Dim Powers As Double, X1 As Variant
X = Abs(X)
Powers = 10 ^ (Int(Log(X) / Log(10#)) + 1)
X1 = X / Powers
CountSF = Len(X1) - 1
End Function

Significant Figure

Copyrightofwww.ExcelExpertTraining.com

202

General Functions

=SUM(Sheet1:Sheet10!A1:A100)

A1:A100 sheet sheet 1 10

=COUNTA(Sheet1:Sheet10!A1:A100)

A1:A100

sheet sheet 1 10

=COUNTIF(data,"<0")

=COUNTIF(data,"yes")


"yes"

=COUNTIF(data,"*")

=COUNTIF(data,"s*")

Copyrightofwww.ExcelExpertTraining.com

203


"s"

=COUNTIF(data,"*s*")


"s"

=COUNTIF(data,"yes")+COUNTIF(data,"no")


"yes" "no"

=COUNTIF(data,"???")

10 =COUNTIF(data,">=1")-COUNTIF(data,">10")


1 10

11 =SUMIF(A2:A10,"Jan",C2:C10)

C2:C10 A2:A10 = "Jan"

12 =COUNTIF(A2:A10,"Jan",C2:C10)

Copyrightofwww.ExcelExpertTraining.com

204

C2:C10 A2:A10 = "Jan"

13 =SUMIF(A2:A10,"<>Jan",C2:C10)

C2:C10 A2:A10 <> "Jan"

14 =SUMIF(Month,"Jan",Sales)+SUMIF(Month,"Feb",Sales)

Sales Month="Jan" "Feb"

15

=SUMIF(A1:A6,"Part#1",B1:B6)
=SUMPRODUCT((A1:A6="Part#1")*(B1:B6))

Part#1

16 =SUM(IF(FREQUENCY(data,data)>0,1,0))


unique numeric values

17

=IF(COUNTIF(A$2:A2,A2)>1,COUNTIF(A$2:A2,A2),"")
=IF(COUNTIF(A$2:A2,A2)>1,"Dup","")

Copyrightofwww.ExcelExpertTraining.com

205

=IF(A1>=1,INT(A1)&"' ","") & TEXT(MOD(A1,1)*12,"18

0"&IF(ABS(MOD(A1,1)*12-ROUND(MOD(A1,1)*12,0))>1/32,"
0/"&CHOOSE(ROUND(MOD(MOD(A1,1)*12,1)*16,0),16,8,16,4,16,
8,16,2,16,8,16,4,16,8,16),"")) &""""

feet decimal feet feet, inches


1/16 inch fractions.

=INT(A1/12)&"' " & TEXT(MOD(A1,12),"0"&IF(ABS(MOD(A1,12)19

ROUND(MOD(A1,12),0))>1/32,"
0/"&CHOOSE(ROUND(MOD(MOD(A1,12),1)*16,0),
16,8,16,4,16,8,16,2,16,8,16,4,16,8, 16),"")) & """"

inches decimal fractions feet


inches 1/16th inch fractions

=TEXT(A1,"0"&IF(ABS(A1-ROUND(A1,0))>1/32," 0/"& CHOOSE(


20 ROUND(MOD(A1,1)*16,0),16,8,16,
4,16,8,16,2,16,8,16,4,16,8,16),"")) &""""

inches decimal fractions inches


only with rounded 1/16th inch fractions

=VALUE(LEFT(A1,FIND("'",A1)-1)) +
21 VALUE(MID(A1,FIND("'",A1) +1,FIND("""",A1)-FIND("'",A1)1))/12

Copyrightofwww.ExcelExpertTraining.com

206

Feet and Inches feet

22

=VALUE(LEFT(A1,FIND("'",A1)-1))*12 +
VALUE(MID(A1,FIND("'",A1) +1,FIND("""",A1)-FIND("'",A1)-1))

Feet and Inches back inches

=SUM(E4:E23)

E4:E23

=SUBTOTAL(9;G4:G26)

=SUMPRODUCT(E4:E13;F4:F13)

G4:G26 visible
cells

n E4:E13
F4:F13

23
{=SUM(E4:E13*F4:F13)}

array formula

=SUMSQ(E4:E13)

S(x)

=SUMX2MY2(E4:E13;E14:E23)

S(x - y)

=SUMX2PY2(E4:E13;E14:E23)

S(x + y)

=SUMXMY2(E4:E13;E14:E23)

S(x - y)

Copyrightofwww.ExcelExpertTraining.com

207

24 =COUNTBLANK(E2:E23)

25 =CELL("filename")

path- filenames

26 =RAND()*100

0 100

27 =RAND()*(100-50)+50

50 100

28 =ROUND(RAND()*100,0)

0 100

29

Copyrightofwww.ExcelExpertTraining.com

208

100 =SUM($A$1:A1)

200 =SUM($A$1:A2)

300 =SUM($A$1:A3)

400 =SUM($A$1:A4)

500 =SUM($A$1:A5

30 =LEN(B1)-LEN(SUBSTITUTE(SUBSTITUTE(B1,"B",""),"b",""))

count the number of "B"s, both upper and lower case, in the
string in B1

31 =OFFSET(Sheet1!$A$2,0,0,COUNTA($A$2:$A$20),1)

Dynamic Ranges

32

=RIGHT(A2,LEN(A2)-FIND("*",SUBSTITUTE(A2," ","*",LEN(A2)LEN(SUBSTITUTE(A2," ","")))))

To return the last name. Suppose cell A2 contains the name

Copyrightofwww.ExcelExpertTraining.com

209

"John A Smith"

33

=LEFT(A2,FIND("*",SUBSTITUTE(A2," ","*",LEN(A2)LEN(SUBSTITUTE(A2," ",""))))-1)

To return the first name, including the middle name (if


present),

34 =LEFT(B2,FIND(" ",B2,1))

To return the first name, without the middle name (if


present),

35 =LEFT(A1,FIND(" ",A1,1))

Returning First Word In A String

36 =RIGHT(A1,LEN(A1)-FIND(" ",A1,1))

Returning All But First Word In A String

"Grades" which refers to ={0,"F";60,"D";70,"C";80,"B";90,"A"}


37
=VLOOKUP(A1,Grades,2)

Copyrightofwww.ExcelExpertTraining.com

210

to convert the number to the grade:

38

=IF(ROW()-ROW(TopRng)+1>TopN,"",LARGE(RankRng,ROW()ROW(TopRng)+1))

Ranking Numbers : to return the N highest or lowest values


from a range of data
Suppose we have a range of numeric data called
RankRng. Create a range next to RankRng (starting in the
same row, with the same number of rows) called TopRng.
Also, create a named cell called TopN, and enter into it the
number of values you want to return (e.g., 5 for the top 5
values in RankRng). Enter the following formula in the first
cell in TopRng, and use Fill Down to fill out the range

39

=IF(ROW()-ROW(TopRng)+1>TopN,"",SMALL(RankRng,ROW()ROW(TopRng)+1))

To return the TopN smallest values of RankRng

40 =CELL("filename",A1)

To return the full sheet name (including the file path)

41 =MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,

Copyrightofwww.ExcelExpertTraining.com

211

LEN(CELL("filename",A1))-FIND("]",CELL("filename",A1)))

To return the sheet name, without the path

42

=MID(CELL("filename",A1),FIND("[",CELL("filename",A1))+1,FIND("]",
CELL("filename",A1))-FIND("[",CELL("filename",A1))-1)

To return the file name without the path

=LEFT(CELL("filename",A1),FIND("]",CELL("filename",A1))) Or
43 =SUBSTITUTE(SUBSTITUTE(LEFT(CELL("filename",A1),FIND("]",
CELL("filename",A1))),"[",""),"]","")

To return the file name with the path

=RadiusEarth*ACOS(COS(RADIANS(9044

(Lat1*24)))*COS(RADIANS(90-(Lat2*24)))+
SIN(RADIANS(90-(Lat1*24)))*SIN(RADIANS(90-(Lat2*24)))*
COS(RADIANS(24*(Long1-Long2))))

Great Circle Distances


Lat1 is the latitude of point 1, entered as DD:MM:SS.
Long1 is the longitude of point 1, entered as DD:MM:SS.
Lat2 is the latitude of point 2, entered as DD:MM:SS.
Long2 is the longitude of point 2, entered as DD:MM:SS.
RadiusEarth is the radius of the earth (3,963 miles or 6,377

Copyrightofwww.ExcelExpertTraining.com

212

kilometers).

=RadiusEarth*ACOS(COS(RADIANS(9045

Lat1))*COS(RADIANS(90-Lat2))+
SIN(RADIANS(90-Lat1))*SIN(RADIANS(90Lat2))*COS(RADIANS(Long1-Long2)))

mixing hemispheres, enter Northern and Western coordinates


as positive, and Southern and Eastern coordinates as
negative

46

=LEFT(A2,IF(ISERROR(FIND(",",A2,1)),LEN(A2),FIND(",",A2,1)1))

To return the last name of the full name in A2

=TRIM(IF(ISERROR(FIND(",",A2,1)),A2,MID(A2,FIND(",",A2,1)+1,
47 IF(ISERROR(FIND(" ",A2,FIND(",",A2,1)+2)),LEN(A2),
FIND(" ",A2,FIND(",",A2,1)+2))-FIND(",",A2,1))))

To return the first name

=TRIM(RIGHT(A2,LEN(A2)-IF(ISERROR(FIND(" ",A2,
48 FIND(" ",A2,FIND(",",A2,1)+2))),LEN(A2),
FIND(" ",A2,FIND(" ",A2,FIND(",",A2,1)+2))-1)))

Copyrightofwww.ExcelExpertTraining.com

213

To return the middle name

49 =MAX(A1:A10,B1)

the highest score ever reached


the Tolls->Options dialog, click on the Calculation tab, and
check the Interations check box

50 =SUM(INDIRECT("A1:A10"))

=SUM($A$1:$A$10),

51

=A1&IF(AND(A1>=10,A1<=14),"th",
CHOOSE(MOD(A1,10)+1,"th","st","nd","rd","th","th","th","th","th","th"))

return the number in A1 with the suffix appended

52 =RANK(C7,C$7:C$16)+COUNTIF(C$7:C7,C7)-1

Unique Ranks

53

=COUNT(C$7:C$16)(RANK(C7,C$7:C$16)+COUNTIF(C$7:C7,C7))+2

Copyrightofwww.ExcelExpertTraining.com

214

Reverse Unique Ranks

54 =CELL("filename",A1)

D:\driveM\excel\TAXES\[1996FEDT.XLS]Sheet1

55

=LEFT(CELL("filename",A1),FIND("[",CELL("filename",A1),1)-1)
=INFO("directory")

D:\driveM\excel\TAXES\

56

=SUBSTITUTE(LEFT(CELL("filename",A1),FIND("]",CELL("filename",A1),1)1),"[","")

D:\driveM\excel\TAXES\1996FEDT.XLS

57

=SUBSTITUTE(SUBSTITUTE(CELL("filename",A1),"[",""),"]"," [")
& "]"

D:\driveM\excel\TAXES\1996FEDT.XLS [Sheet1]

=SUBSTITUTE(LEFT(LOWER(CELL("filename",A1)),FIND("]",
58 CELL("filename",A1))-1),"[","") & " [" &
MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,28) &

Copyrightofwww.ExcelExpertTraining.com

215

"]"

d:\drivem\excel\taxes\1996fedt.xls [Sheet1]

59

=MID(CELL("filename",A1),FIND("[",CELL("filename",A1),1)+1,FIND("]",
CELL("filename",A1),1)-FIND("[",CELL("filename",A1),1)-1)

1996FEDT.XLS

=RIGHT(CELL("filename",A1),LEN(CELL("filename",A1))60

FIND("]", CELL("filename",A1)))
=MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,99)
=SheetName()

Sheet1

=INFO("directory")
61

directory, memavail, memused, numfile, origin, osversion, recalc,


release, system, totmem

C:\WINNT\Profiles\Administrator\Personal\

62

=UPPER(LEFT(A37,1)&"."&MID(A37,FIND(" ",A37&" ")+1,1)&".


")

Copyrightofwww.ExcelExpertTraining.com

216

Extract the first two initials

63

=IF(LEN(A11)=0,"",IF(ISERR(FIND("
",A11)),A11,LEFT(A11,FIND(" ",A11)-1)))

Extract the first word

=len(a1)-len(substitute(a1,"a",""))

lettercase must match

64 =len(a1)-len(substitute(upper(a1),"A",""))

lettercase does

not matter

Find number of occurrences of a character in a cell

65 =LEN(A1)-LEN(SUBSTITUTE(A1,",",""))+(LEN(TRIM(A1))>0)

Find the number of items separated by commas

66

=LEN(SUBSTITUTE(TRIM(A1),CHAR(32),CHAR(32)&CHAR(32))
)-LEN(TRIM(A1))+1

Find the number of words in a string

67 =LEN(A1)-LEN(SUBSTITUTE(A1,"aa","")))/LEN("aa")

Find the number of occurences of a string in a single cell

Copyrightofwww.ExcelExpertTraining.com

217

68 =countif(A1:J1,"aa")

Find the number of cells in a range that have string as their


value

=IF(ISERR(FIND("/",E22)),E22,MID(E22,FIND("/",E22,1)+1,99))
69 =IF(ISERR(FIND("/",E22)),"",MID(E22,FIND("/",E22,1)+1,99))

Return string after first "/" character

=NOT(ISNUMBER(VALUE(LEFT(D7,1))))
70
=IF(LEFT(TRIM(D7))="","",NOT(ISNUMBER(VALUE(LEFT(D7,1)))))

First Character checked as alphabetic character

71 =SUBSTITUTE(A1," ","")

Remove All Spaces

=IF(MOD(INT(16*(+B2INT(B2)+0.0312)),16)=0,TEXT(B2,"#"),IF(MOD(INT(16*(+B272 INT(B2)+0.0312)),8)=0,TEXT(B2,"#
0/2"),IF(MOD(INT(16*(+B2-INT(B2)+0.0312)),4)=0,TEXT(B2,"#
0/4"),IF(MOD(INT(16*(+B2-INT(B2)+0.0312)),2)=0,TEXT(B2,"#

Copyrightofwww.ExcelExpertTraining.com

218

0/8"),TEXT(B2,"# 0/16")))))

to reduce 8/16's to 1/2, 10/16 to 5/8

73 =SUMPRODUCT(B2:B6,C2:C6)/SUM(C2:C6)

Weighted Average

74 =OFFSET(MySheet!$A$1,0,0,COUNTA(MySheet!$A:$A),1)

Dynamic Named Ranges

=POWER((SUM(IF(values0,values*(POWER(1+rRate,(MAX(dates)75

dates)/daybase)) ,0)))/(SUM(IF(values<0,values/(POWER
(1+iRate,(MAX(dates)-dates)/daybase)) ,0)))*-1,1/((MAX(dates)MIN(dates))/daybase))-1

combine the functionality of the XIRR and MIRR functions


values is the row or column range of cashflows
dates is the row or column range of corresponding dates
iRate is the interest rate you pay on the money used in the
cash flows
rRate is the interest rate you receive on the cash flows as you
reinvest them
daybase is days-in-year basis to use (usually 360 or 365).

Copyrightofwww.ExcelExpertTraining.com

219

=MROUND(Num,IF(VALUE(RIGHT(Num/10^(INT(LOG(ABS(Num)))76 Plc+1),2))=0.5,2,1)* SIGN(Num)*10^(INT(LOG(ABS(Num)))-Plc+1))


=MROUND(Num,IF(VALUE(RIGHT(Num/Fact,2))=0.5,2,1)*SIGN(Num)*Fact)

'bankers rounding' for a number (Num) to a given number (Plc) of


significant digits
define 'Fact' as =10^(INT(LOG(ABS(Num)))-Plc+1),

77 =INDEX(FREQUENCY((A1,A3,A5),20),2)

20

=LEN(A1)-LEN(SUBSTITUTE(A1,"B",""))
78
=LEN(A1)-LEN(SUBSTITUTE(SUBSTITUTE(A1,"B",""),"b",""))

=SUM(LEN(A1)-LEN(SUBSTITUTE(A1,B1,"")))/LEN(B1)
79 =SUM(LEN(A1)LEN(SUBSTITUTE(UPPER(A1),UPPER(B1),"")))/LEN(B1)

B1 A1

80 =A1&IF(OR(VALUE(RIGHT(A1,2))={11,12,13}),

Copyrightofwww.ExcelExpertTraining.com

220

"th",IF(OR(VALUE(RIGHT(A1))={1,2,3}),CHOOSE(RIGHT(A1),
"st","nd","rd"), "th"))

Ordinal Number

81

=IF(AND(A1>0,A1<257),IF(A1>26,CHAR(CEILING(A1/26,1)+63),"")
&CHAR(IF(MOD(A1,26)=0,26,MOD(A1,26))+64),"")

column column

82

=MID(A1,FIND("*",SUBSTITUTE(A1,"\","*",LEN(A1)LEN(SUBSTITUTE(A1,"\",))))+1,LEN(A1))

file c:\MainDir\
file

83

=IF(ISERR(LEFT(A1,FIND(" ",A1)-1)),A1,LEFT(A1,FIND(" ",A1)1))

=IF(LEN(A4)-LEN(SUBSTITUTE(A4," ",""))=0, A4,


84 RIGHT(A4,LEN(A4) -FIND("*",SUBSTITUTE(A4," ", "*", LEN(A4)LEN(SUBSTITUTE(A4," ",""))))))

Copyrightofwww.ExcelExpertTraining.com

221

85 =RIGHT(A1,LEN(A1)-FIND(" ",A1,1))

=LEFT(A1,FIND(" ",A1)-1)
=IF(ISERR(MID(A1,FIND(" ",A1)+1,IF(ISERR(FIND(" ",A1,FIND("
",A1)+1)),FIND(" ",A1),FIND(" ",A1,FIND(" ",A1)+1))-FIND("
86

",A1)-1)),"",MID(A1,FIND(" ",A1)+1,IF(ISERR(FIND("
",A1,FIND(" ",A1)+1)),FIND(" ",A1), FIND(" ",A1,FIND("
",A1)+1))-FIND(" ",A1)-1))
=RIGHT(A1,LEN(A1)-FIND("*",SUBSTITUTE(A1," ","*",LEN(A1)LEN(SUBSTITUTE(A1," ","")))))

first name, middle names, last names

87

=IF(OR(LEFT(A1,2)="Mr",LEFT(A1,3)="Mrs",LEFT(A1,2)="Ms"),
RIGHT(A1,LEN(A1)-FIND(" ",A1)),A1)

88

=LEN(SUBSTITUTE(TRIM(A1),CHAR(32),CHAR(32)&CHAR(32)))LEN(TRIM(A1))+1

Copyrightofwww.ExcelExpertTraining.com

222

=LEFT(TRIM(A1),FIND(" ",TRIM(A1),1)-1)&"
89

"&RIGHT(TRIM(A1),LEN(TRIM(A1))-IF(ISERROR(FIND("
",TRIM(A1),FIND(" ",TRIM(A1),1)+1)),FIND("
",TRIM(A1),1),FIND(" ",TRIM(A1),FIND(" ",TRIM(A1),1)+1)))


middle names

=SUBTOTAL(9, INDIRECT(ADDRESS( ROW(C3),COLUMN(C3)


90 )&":"& ADDRESS( ROW(C3),
ROW(INDIRECT(COLUMN(C3)&":"&COLUMN(G3))) )))

Cumulative Sum C3:G3

91

,
) - MAX(
=MAX( 0, MIN(
,

))

92 =IF( Date>=Start, Amount, 0 )

Amount

93 =IF( Date<=Stop, Amount, 0 )

Amount

Copyrightofwww.ExcelExpertTraining.com

223

94 =IF( AND( Date>=Start, Date<=Stop ), Amount, 0 )

Amount

95

=IF( AND( Date>=Start, Date<=Stop, OR( MOD( DateStart+1,Cycle ) = 1,Cycle = 1 ) ), Amount, 0 )

Amount
Cycle

Copyrightofwww.ExcelExpertTraining.com

224

Day and Time Formulas

=DATEDIF(Date1,Date2,Interval)



Interval Code
"m"

"d

"y"

"ym"

"yd"

"md"

=DATEDIF(,NOW(),"y") & " years, " & DATEDIF(


2

,NOW(),"ym") & " months, " & DATEDIF(,NOW(),"md") & "


days"

Copyrightofwww.ExcelExpertTraining.com

225

3 =AND((TDate>=MIN(TDate1,TDate2)),TDate<=MAX(TDate1,TDate2))

TDate TDate1 TDate2

=IF(OR(Date2<VDate1,VDate2<Date1),Date2Date1+1,IF(OR(AND(Date1<=VDate1,Date2>=VDate2),
AND(Date1>=VDate1,Date2<=VDate2)),MAX(0,(Date2-Date1)-(VDate24 VDate1)),
IF(OR(AND(Date1<=VDate1,Date2<=VDate2),AND(Date1>=VDate1,Date2>V
Date2)),
MAX(0,(VDate1-Date1))+MAX(0,Date2-VDate2),NA())))

Date1

Date2

VDate1

VDate2

Copyrightofwww.ExcelExpertTraining.com

226

NWRange

=IF(OR(Date2<VDate1,VDate2<Date1),NETWORKDAYS(Date1,Date2,NWRang
e),
IF(OR(AND(Date1<=VDate1,Date2>=VDate2),AND(Date1>=VDate1,Date2<=
VDate2)),
5

MAX(0,NETWORKDAYS(Date1,Date2,NWRange)NETWORKDAYS(VDate1,VDate2,NWRange)),
IF(OR(AND(Date1<=VDate1,Date2<=VDate2),AND(Date1>=VDate1,Date2>V
Date2)),
IF((Date1>=VDate1),0,NETWORKDAYS(Date1,VDate1-1,NWRange))+
IF((Date2<=VDate2),0,NETWORKDAYS(VDate2+1,Date2,NWRange)),NA())))

=IF(OR(IDate2<RDate1,IDate1>RDate2),0,(MIN(IDate2,RDate2)MAX(IDate1,RDate1)+1))

IDate1

IDate2

Copyrightofwww.ExcelExpertTraining.com

227

RDate1

RDate1

NWRange

=IF(OR(IDate2<RDate1,IDate1>RDate2),0,
ABS(NETWORKDAYS(MIN(IDate2,RDate2),MAX(IDate1,RDate1),NWRange)))

=MAX(0,NETWORKDAYS(MAX(D$5,$B6),MIN(DATE(YEAR(D$5),MONTH(D$5)+
1,0),$C6)))

=MAX(0,(MIN($C17,DATE(YEAR(D$16),MONTH(D$16)+1,0))MAX($B17,D$16)+1))

Copyrightofwww.ExcelExpertTraining.com

228

=MAX(0,NETWORKDAYS(MAX(DATE(D$27,1,1),$B28),MIN(DATE(D$27,12,31

),$C28)))

11

=MAX(0,(MIN($C39,DATE(D$38,12,31))MAX($B39,DATE(D$38,1,1))+1))

Copyrightofwww.ExcelExpertTraining.com

229

=FLOOR("5/"&DAY(MINUTE(B2/38)/2+56)&"/"&B2,7)-34
12
=FLOOR(DAY(MINUTE(B2/38)/2+56)&"/5/"&B2,7)-34

Easter
B2
Easter

13 =TRUNC(((B6-DATE(YEAR(B6),1,0))+6)/7)

=INT((A1-SUM(MOD(DATE(YEAR(A1-MOD(A1-2,7)+3),1,2),
{1E+99,7})*{1,-1})+5)/7)
14
=1+INT((A1-DATE(YEAR(A1+4-WEEKDAY(A1+6)),1,5)+
WEEKDAY(DATE(YEAR(A1+4-WEEKDAY(A1+6)),1,3)))/7)

ISO

15 =RIGHT(YEAR(A1),2)&TEXT(A1-DATE(YEAR(A1),1,0),"000")


Julian Date

16 =DATE(IF(0+(LEFT(A1,2))<30,2000,1900)+LEFT(A1,2),1,RIGHT(A1,3))

Julian date

Copyrightofwww.ExcelExpertTraining.com

230

=DATE(IF(0+(LEFT(A1,2))<30,2000,1900)+LEFT(A1,2),1,RIGHT(A1,3))
17 DATE(IF(0+(LEFT(A2,2))<30,2000,1900)+LEFT(A2,2),1,RIGHT(A2,3))

Julian Dates

18 =DATE(IF(0+(LEFT(A1,2))<30,2000,1900)+LEFT(A1,2),1,RIGHT(A1,3)+A2)

Julian Date

=IF(ROW(A1),CALL("Xlcall32","Excel4","2JRJ",74))
19
=IF(ROW(A1:A4),CALL("Xlcall32","Excel4","2JRJ",74))

=IF(INT(StartDT)=INT(EndDT),"0 days " & ROUND(24*(EndDTStartDT),2)&"hours",MAX(NETWORKDAYS(StartDT+1,EndDT1,HolidayList),0)+INT(24*(((EndDT-INT(EndDT))-(StartDT20 INT(StartDT)))+(DayEnd-DayStart))/(24*(DayEnd-DayStart)))&"


days "&MOD(ROUND(((24*(EndDT-INT(EndDT)))24*DayStart)+(24*DayEnd-(24*(StartDT-INT(StartDT)))),2),
ROUND((24*(DayEnd-DayStart)),2))&" hours ")

Copyrightofwww.ExcelExpertTraining.com

231

StartDT

EndDT

DayStart

DayEnd

HolidayList

25-Oct-99

13:00

28-Oct-99
15:00

9:00

17:00

H1:H10

=IF(INT(StartDT)=INT(EndDT),ROUND(24*(EndDT-StartDT),2),
(24*(DayEnd-DayStart)*(MAX(NETWORKDAYS(StartDT+1,EndDT1,HolidayList),0)+INT(24*(((EndDT-INT(EndDT))21 (StartDT-INT(StartDT)))+(DayEnd-DayStart))/(24*(DayEndDayStart))))+MOD(ROUND(((24*(EndDT-INT(EndDT)))24*DayStart)+(24*DayEnd-(24*(StartDT-INT(StartDT)))),2),
ROUND((24*(DayEnd-DayStart)),2))))

Copyrightofwww.ExcelExpertTraining.com

232

22 =IF(OR(WEEKDAY(A4+1)=1,WEEKDAY(A4+1)=7),A4+3,A4+1)


A4

23 =DAY(DATE(YEAR(A1),MONTH(A1)+1,0))

24 =DATE(YEAR(A1),MONTH(A1)+1,0)

25 =DATE(YEAR(A1),MONTH(A1),0)

26

=DATE(Yr,Mon,1+((Nth-(DoW>=WEEKDAY(DATE(Yr,Mon,1))))*7)+
(DoW-WEEKDAY(DATE(Yr,Mon,1))))

return the date of Nth day-of-week for a given month and year.
For example, it will return 26-March-98 for the 4th Thursday of
March, 1998. Days-of-week range from 1 to 7, with Sunday =
1 and Saturday = 7.
Where Yr, Mon, Nth, and DoW are cell references or values
indicating Year, Month, Nth, and Day-Of-Week.

Copyrightofwww.ExcelExpertTraining.com

233

27

=DATE(Yr,1,1+(Nth-(Dow>=WEEKDAY(DATE(Yr,1,1))))*7)+
Dow-WEEKDAY(DATE(Yr,1,1))

return the date of Nth day-of-week for a given year


Where Yr,Nth, and DoW are cell references or values indicating
Year, Month, Nth, and Day-Of-Week

28 =TRUNC((B1-A1)/7)&" Weeks "&MOD(B1-A1,7)&" Days"

29 =IF(ISERROR(VLOOKUP(WEEKDAY(A1),WorkDays,1,0)),FALSE,TRUE)

30 =ROUNDUP(MONTH(A1)/3,0)

31

=TRUNC(((A1-DATE(YEAR(A1),1,1))/7))+1+
IF(WEEKDAY(DATE(YEAR(A1),1,1))>WEEKDAY(A1),1,0)

Copyrightofwww.ExcelExpertTraining.com

234

32 =DATE(YEAR(A1)+1,MONTH(A1)+6, DAY(A1)+10)

1 6 10

33 =IF(A1>B1,B1+1-A1,B1-A1)

34 =TIME(HOUR(A1),MROUND(MINUTE(A1),B1),0)


A1

B1

=TIME(HOUR(A1),FLOOR(MINUTE(A1),B1),0)
35
=TIME(HOUR(A1),CEILING(MINUTE(A1),B1),0)

36 =SUMPRODUCT(N(MONTH(A1:A20)=12))

37 =SUMPRODUCT((MONTH(A1:A20)=12)*(YEAR(A1:A20)=2000))

Copyrightofwww.ExcelExpertTraining.com

235



2000

=SUMPRODUCT(N(A1:A20>DATE(2000,11,15))*N(A1:A20<=DATE(2000,12,
3

15)))

8
=countif(A1:A20,">=16/11/2000")-countif(A1:A20,">15/12/2000")



16 15

39 =(A1>B1)+B1-A1

1 TIME Time

2 1

0:01:00

3 2

0:02:00

4 3

0:03:00

40

=ROUNDDOWN(A2,-2) / 2400 + MOD(A2,100) /


1440

=ROUNDDOWN(A3,-2) / 2400 + MOD(A3,100) /


1440

=ROUNDDOWN(A4,-2) / 2400 + MOD(A4,100) /


1440

Copyrightofwww.ExcelExpertTraining.com

236

5 1200

12:00:00

6 1201

12:01:00

7 2400

0:00:00

8 3359

9:59:00

=ROUNDDOWN(A5,-2) / 2400 + MOD(A5,100) /


1440

=ROUNDDOWN(A6,-2) / 2400 + MOD(A6,100) /


1440

=ROUNDDOWN(A7,-2) / 2400 + MOD(A7,100) /


1440

=ROUNDDOWN(A8,-2) / 2400 + MOD(A8,100) /


1440

=INT((A1-(DATE(YEAR(A1+(MOD(8-WEEKDAY(A1),7)-3)),1,1))-3+
41 MOD(WEEKDAY(DATE(YEAR(A1+(MOD(8-WEEKDAY(A1),7)3)),1,1))+1,7))/7)+1

42 =NOW()+12/24

12 (24 / )

43 =NOW()+10/1440

Copyrightofwww.ExcelExpertTraining.com

237

10

(1440 / )

44 =NOW()+30/86400

30
(86400 / )

A2: =TODAY()
45 B2: =A2-MOD(A2-2,7)
C2: =B2

Monday week starting dates

=A2&IF(INT(MOD(A2,100)/10)=1, "th", IF(MOD(A2,10)=1, "st",


IF(MOD(A2,10)=2,"nd", IF(MOD(A2,10)=3, "rd","th"))))
46 =DAY(A2)&IF(INT(MOD(DAY(A2),100)/10)=1, "th",
IF(MOD(DAY(A2),10)=1, "st", IF(MOD(DAY(A2),10)=2,"nd",
IF(MOD(DAY(A2),10)=3, "rd","th"))))& " " & TEXT(A2,"mmmm,
yyyy")

st nd rd th

47 =MROUND(A22,1/(24*4))

Rounding to nearest quarter hour

Copyrightofwww.ExcelExpertTraining.com

238

48 =FLOOR(A22,1/(24*4))

Rounding down to nearest quarter hour

49 =CEILING(A22,1/(24*4))

Rounding Up to nearest quarter hour

50 =TEXT(NOW(),"dd mmmm yyyy")

(
US/Canada mm/dd/yyyy)

04/14/200
1
5
1

First Day of Week

Last Day of Week

First Day of Month

04/08/200
1

04/14/200
1

Sat 36995

Sun =B1-WEEKDAY(B1)+1

Sat =B1-WEEKDAY(B1)+7

04/01/200 Sun =DATE(YEAR(B1),MONTH(B1),1)

Copyrightofwww.ExcelExpertTraining.com

239

Last Day of Month

First Day of Year

Last Day of Year

Closest Monday

04/30/200 Mo
1

04/01/200
1

Sun =DATE(YEAR(B1),MONTH(B1),1)

12/31/200 Mo
1

=DATE(YEAR(B1),MONTH(B1)+1,0)

=DATE(YEAR(B1)+1,1,0)

04/16/200 Mo =DATE(YEAR(B1),MONTH(B1),DAY(
1

B1)
+CHOOSE(WEEKDAY(B1),1,0,-1,-2,3,3,2,1))

Next Monday

04/16/200 Mo =DATE(YEAR(B1),MONTH(B1),DAY(
1

B1)
+CHOOSE(
WEEKDAY(B1),1,7,6,5,4,3,2))

Next Monday

04/16/200 Mo =A1-WEEKDAY(A1,2)+8
1

1st Monday of
Month

04/02/200 Mo =DATE(YEAR(B1),MONTH(B1),
1

CHOOSE(WEEKDAY(DATE(YEAR(B1)
,
MONTH(B1),1)),2,1,7,6,5,4,3))

Copyrightofwww.ExcelExpertTraining.com

240

2nd Monday of Mont 04/09/200 Mo =DATE(YEAR(B1),MONTH(B1),7


h

+CHOOSE(WEEKDAY(DATE(YEAR(B
1),
MONTH(B1),1)),2,1,7,6,5,4,3))

3rd Monday of
Month

04/16/200 Mo =DATE(YEAR(B1),MONTH(B1),14
1

+CHOOSE(WEEKDAY(DATE(YEAR(B
1),
MONTH(B1),1)),2,1,7,6,5,4,3))

4th Monday of
Month

04/23/200 Mo =DATE(YEAR(B1),MONTH(B1),21
1

+CHOOSE(WEEKDAY(DATE(YEAR(B
1),
MONTH(B1),1)),2,1,7,6,5,4,3))

5th Monday of
Month

04/30/200 Mo =IF(MONTH(DATE(YEAR(B1),
1

MONTH(B1),28+
CHOOSE(WEEKDAY(DATE(YEAR(B1)
, MONTH(B1),1)),2,1,7,6,5,4,3)))=
MONTH(B1),DATE(YEAR(B1),
MONTH(B1),28
+CHOOSE(WEEDATE(YEAR(B1),
MONTH(B1),1)),
2,1,7,6,5,4,3)),"none")

Last Monday of
Month

04/30/200 Mo =DATE(YEAR($B$1),
1

MONTH($B$1)+1,1)WEEKDAY(DATE(YEAR($B$1),

Copyrightofwww.ExcelExpertTraining.com

241

MONTH($B$1)+1,6))

For a different day of the week rotate the 2nd to last parameters in
CHOOSE.
i.e. 7,6,5,4,3,2,1 for Wednesday instead of 2,1,7,6,5,4,3 for Monday as
used in some of the formulae.

Formula in C1 & D1, downward

=IF(ISNUMBER(B1),WEEKDAY(B1),"
")

format
Dates

mm/dd/yyy
y

5
2

First ddd
of Month

Last ddd
of Month

First
Sunday of

03/01/1999 =DATE(YEAR(B18),MONTH(B18),1)

03/31/1999 =DATE(YEAR($B$18),MONTH($B$18)+1,1)-1

03/07/1999

=DATE(YEAR($B$18),MONTH($B$18),1)+
MOD(1+7-

Copyrightofwww.ExcelExpertTraining.com

242

Mo.

WEEKDAY(DATE(YEAR($B$18),MONTH($B$18),1))
,7)

=DATE(YEAR($B$18),MONTH($B$18),1)+
First
Monday

03/01/1999

MOD(2+7WEEKDAY(DATE(YEAR($B$18),MONTH($B$18),1))
,7)

=DATE(YEAR($B$18),MONTH($B$18),1)+
First
Tuesday

03/02/1999

MOD(3+7WEEKDAY(DATE(YEAR($B$18),MONTH($B$18),1))
,7)

=DATE(YEAR($B$18),MONTH($B$18),1)+

First
Wednesda 03/03/1999
y

MOD(4+7WEEKDAY(DATE(YEAR($B$18),MONTH($B$18),1))
,7)

=DATE(YEAR($B$18),MONTH($B$18),1)+
First
Thursday

03/04/1999

MOD(5+7WEEKDAY(DATE(YEAR($B$18),MONTH($B$18),1))
,7)

=DATE(YEAR($B$18),MONTH($B$18),1)+
First
Friday

03/05/1999

MOD(6+7WEEKDAY(DATE(YEAR($B$18),MONTH($B$18),1))
,7)

Copyrightofwww.ExcelExpertTraining.com

243

=DATE(YEAR($B$18),MONTH($B$18),1)+
First
Saturday

03/06/1999

MOD(7+7WEEKDAY(DATE(YEAR($B$18),MONTH($B$18),1))
,7)

Last

=DATE(YEAR($B$18),MONTH($B$18)+1,1)-

Sunday of 03/28/1999 WEEKDAY(DATE(YEAR($B$18),MONTH($B$18)+1,


Mo.

Last
Monday

Last
Tuesday

Last

7))

=DATE(YEAR($B$18),MONTH($B$18)+1,1)03/29/1999 WEEKDAY(DATE(YEAR($B$18),MONTH($B$18)+1,
6))

=DATE(YEAR($B$18),MONTH($B$18)+1,1)03/30/1999 WEEKDAY(DATE(YEAR($B$18),MONTH($B$18)+1,
5))

=DATE(YEAR($B$18),MONTH($B$18)+1,1)-

Wednesda 03/31/1999 WEEKDAY(DATE(YEAR($B$18),MONTH($B$18)+1,


y

Last
Thursday

4))

=DATE(YEAR($B$18),MONTH($B$18)+1,1)03/25/1999 WEEKDAY(DATE(YEAR($B$18),MONTH($B$18)+1,
3))

=DATE(YEAR($B$18),MONTH($B$18)+1,1)Last Friday 03/26/1999 WEEKDAY(DATE(YEAR($B$18),MONTH($B$18)+1,


2))

Copyrightofwww.ExcelExpertTraining.com

244

Last
Saturday

=DATE(YEAR($B$18),MONTH($B$18)+1,1)03/27/1999 WEEKDAY(DATE(YEAR($B$18),MONTH($B$18)+1,
8))

Last
weeknum

53

=WEEKNUM(DATE(YEAR(B18),12,31),1)

of yr

Description

The date for


Monday in the

=TODAY()-WEEKDAY(TODAY(),2)-6

previous week

53 The date for


Monday in the

=TODAY()-WEEKDAY(TODAY(),2)+1

current week

The date for


Monday in the next =TODAY()-WEEKDAY(TODAY(),2)+8
week

Create a valid date =DATE(2002,12,24)

Copyrightofwww.ExcelExpertTraining.com

245

Create a valid date =DATEVALUE("1.1.1980")

Count of days in a
month

Last date in a
month

=DAY(DATE(YEAR(A1),MONTH(A1)+1,0))

=DATE(YEAR(A1),MONTH(A1)+1,0)

Determine which
quarter a date

=CHOOSE(MONTH(A1),1,1,1,2,2,2,3,3,3,4,4,4)

belongs to

=DAY(A1)&IF(INT(MOD(DAY(A1),100)/10)=1, "th",
54

IF(MOD(DAY(A1),10)=1, "st",IF(MOD(DAY(A1),10)=2,"nd",
IF(MOD(DAY(A1),10)=3, "rd","th"))))& " " &TEXT(A1,"mmmm,
yyyy")

Ordinal Date

Copyrightofwww.ExcelExpertTraining.com

246

List & Database Formulas

=INDEX(Rng,MATCH(MAX(COUNTIF(Rng,Rng)),COUNTIF(Rng,Rng),0))

=INDEX(Rng,MATCH(MIN(COUNTIF(Rng,Rng)),COUNTIF(Rng,Rng),0))

=INDIRECT(ADDRESS(ROW(Rng)+MATCH(C1,Rng,0)-1,COLUMN(Rng)3

ColsToLeft)) Or
=INDIRECT(ADDRESS(ROW(Rng)+MATCH(C1,Rng,0)-1,COLUMN(A:A) ))

Left Lookups

=IF(MAX(COUNTIF(Range1,Range1))>1,"Duplicates","No Duplicates")

=IF(COUNTIF(Range1, A5)>1,TRUE,FALSE)

Copyrightofwww.ExcelExpertTraining.com

247

=IF(COUNTIF(Range1,???)>1,"Duplicate","")

=COUNTIF($A:$A,$A1)>1

=SUM(N(OFFSET(E1,ROW(1:5)-1,-1*ROW(1:5)+1)))
=SUMPRODUCT(N(OFFSET(E1,ROW(INDIRECT("1:5"))-1,8

1*ROW(INDIRECT("1:5"))+1)))
=SUM(N(OFFSET(E1,ROW(INDIRECT("1:5"))-1,1*ROW(INDIRECT("1:5"))+1)))

sum A5:E1

=INDEX(Range2,MATCH(Value,Range1,0))
9

=LOOKUP(Value,Range1,Range2)
=VLOOKUP(Value,Range12,2,FALSE)

Copyrightofwww.ExcelExpertTraining.com

248

Conditional Formatting & Data


Validation Formulas

Conditional Formatting

=MOD(ROW()-Rw,N*2)+1<=N


Rw

N

=MOD(ROW()-Rw,N*2)+1>N


Rw

N

=ISERROR(cell_reference)

Error Values

=ISTEXT(A1)

Copyrightofwww.ExcelExpertTraining.com

249

=A1>AVERAGE($A$1:$D$12)

=MONTH(A1)=6

=A1=TODAY()

=IF(ISBLANK(A1),"",OR(WEEKDAY(A1)=7,WEEKDAY(A1)=1))

=A1=MAX($A$1:$A$30)

10

=OR( A1=LARGE($A$1:$A$30,1), A1=LARGE($A$1:$A$30,2),


A1=LARGE($A$1:$A$30,3) )

Copyrightofwww.ExcelExpertTraining.com

250

11 =MOD(ROW(),2)=0

row

12 =MOD(INT((ROW()-1)/4)+1,2)

row 4 row

13 =MOD(ROW(),2)=MOD(COLUMN(),2)

row column

14 =IF(COUNTIF($A$1:$D$12,A1)>1,TRUE,FALSE)

15 =A2<A1

16

=LEN( SUBSTITUTE(TRIM(A1), CHAR(32), CHAR(32)&CHAR(32)) )LEN(TRIM(A1))+1>1

Copyrightofwww.ExcelExpertTraining.com

251

17 =LEN(A3)-LEN(SUBSTITUTE(SUBSTITUTE(A3,"A",""),"a",""))>0

18 =AND($B$1:$B$4<>"")

=MATCH($A1&$B1&$C1&$D1,$F$6:$F$15&$G$6:$G$15&$H$6:$H$15&$I$6:

$I$15,0)>=1

column $F$6:$F$15 $G$6:$G$15


$H$6:$H$15 $I$6:$I$15

Data Validation

=COUNTIF($A$1:$A$50,A1)=1

=ISNA(VLOOKUP(A9,A$1:A8,1,FALSE))

Copyrightofwww.ExcelExpertTraining.com

252

=ISTEXT(A5)

=A2>A1

=LEFT(A2)="a"

=COUNTIF(A3,"A????")=1

a 5

Copyrightofwww.ExcelExpertTraining.com

253

Array Formulas
Array

Ctrl+Shift+Enter

=SUM(IF(List>0,List,FALSE))
=AVERAGE(IF(List>0,List,FALSE))
1
=MIN(IF(List>0,List,FALSE))
=MAX(IF(List>0,List,FALSE))


FALSE

=SUM(IF(List<>0,List,FALSE))
=AVERAGE(IF(List<>0,List,FALSE))
2

=MIN(IF(List<>0,List,FALSE))
=MAX(IF(List<>0,List,FALSE))

0

FALSE

=SUM(IF((List>=LLim)*(List<=ULim),List,FALSE))

Copyrightofwww.ExcelExpertTraining.com

254

=AVERAGE(IF((List>=LLim)*(List<=ULim),List,FALSE))
=MIN(IF((List>=LLim)*(List<=ULim),List,FALSE))
=MAX(IF((List>=LLim)*(List<=ULim),List,FALSE))

LLim ULim
FALSE

LLim , ULim

=IF(A1=B1,1,0)
=SUM(IF(A1:A10=B1:B10,1,0))
=SUM((A2:A10="Phone")*(B2:B10="Smith")*C2:C10)
4
=SUM(IF((A2:A10="Fax")+(B2:B10="Jones"),1,0))
=SUM(IF(MOD((A2:A10="Fax")+(B2:B10="Jones"),2),1,0))
=SUM(IF((A2:A10="Fax")+(B2:B10="Jones")<>2,1,0)

SUM 1
COUNT



5 =SUM((Month="Jan")*(Region="North")*Sales)

Sales Month="Jan" AND

Copyrightofwww.ExcelExpertTraining.com

255

Region="North"

6 =SUM((Month="Jan")*(Region<>"North")*Sales)

Sales Month="Jan" AND


Region<>"North"

7 =SUM((Month="Jan")*(Region="North"))

Sales Month="Jan"
Region="North"

8 =SUM((Month="Jan")*(Sales>=200)*(Sales))

Sales Month="Jan"
Sales>= 200

9 =SUM((Sales>=300)*(Sales<=400)*(Sales))

Sales 300 400

10 =SUM((Sales>=300)*(Sales<=400))

Sales 300 400

Copyrightofwww.ExcelExpertTraining.com

256

11 =SUM((A1:A10>=5)*(A1:A10<=10)*A1:A10)

5 10

12 =SUM((A1:A10>=5)*(A1:A10<=10))


5 10

=SUM((F4:F23="yes")+(F4:F23="no"))


yes
no

=SUM(MOD(G4:G23,2))

13
=SUM(IF(MOD(G4:G23,2)=0,1,0))

=SUM(IF((F4:F23="yes")*(G4:G23>10),1,0))

=SUM((F5:F24="yes")*(G5:G24>10))

Copyrightofwww.ExcelExpertTraining.com

257

=SUM((F4:F23="yes")+(F4:F23="no"))

=SUM(IF(MOD(ROW($A$1:$A$20),N)=0,$A$1:$A$20,0))
=SUM(IF(MOD(ROW($B$3:$B$22)14 ROW($B$3)+1,N)=0,$B$3:B$20,0))
=SUM(IF(MOD(ROW($B$3:$B$22)ROW($B$3),N)=0,$B$3:B$22,0))

15 =IF(COUNTIF($A$1:A1,A1)=1,A1,"")

16 =IF(COUNTIF($A$1:$A$10,B1)>0,B1,"")

17 =IF(COUNTIF($A$1:$A$10,B1)=0,B1,"")

Copyrightofwww.ExcelExpertTraining.com

258

18 =AVERAGE(IF((A1:A60>=Low)*(A1:A60<=High),A1:A60))


Low High

=AVERAGE(LARGE(A1:A60,ROW(1:10)))
19
=AVERAGE(LARGE(A1:A60,ROW(INDIRECT("1:10"))))




10

"1:10" "1:N"
N

20 =AVERAGE(SMALL(A1:A60,ROW(INDIRECT("1:10"))))




10

"1:10" "1:N"
N

21 =SUM(IF(ISERR(data),1,0))


error

Copyrightofwww.ExcelExpertTraining.com

259

=SUM(E4:E13*F4,F13)

E4:E13
F4:F13

=SUM((E4:E23)*(MOD(ROW(E4:E23)

-ROW(E4),2)=0))

=SUM((E4:E23)*(MOD(ROW(E4:E23)

-ROW(E4),5)=0))

22 =SUM(IF(MOD(I4:I23;2)=0,I4:I23,0))

=SUM(IF(MOD(I4:I23,2)<>0,I4:I23,0))

=SUM(IF((E4:E23>50)*(H4:H23="North"),
E4:E23,0))

=SUM((E5:E24>50)*(H5:H24="North")

*E5:E24,0)

=SUM((H4:H23="North")*E4:E23

+(H4:H23="South")*E4:E23)

Copyrightofwww.ExcelExpertTraining.com

260

23 =OFFSET(List,MAX(ROW(RevList))-ROW(),0)

24

=OFFSET(RowList,0,MAX(COLUMN(RevRowList))COLUMN())

RowList ,
RevRowList

=OFFSET(CList,COLUMN()-MIN(COLUMN(RList)),0)
25 =OFFSET(CList,MAX(COLUMN(RevRList))COLUMN(),0)

CList RList
RevRList

=OFFSET(RowList,0,ROW()-MIN(ROW(TXList)))
26 =OFFSET(RowList,0,MAX(ROW(TList))-ROW())

Copyrightofwww.ExcelExpertTraining.com

261

RowList TXList
TList

27

=ADDRESS(MIN(IF(NumRange=MIN(NumRange),ROW(NumRange))),
COLUMN(NumRange),4)

Address


=ADDRESS(MAX(IF(NumRange=MIN(NumRange),ROW(NumRange)*
28 (NumRange<>""))),
COLUMN(NumRange),4)

Address


29

=ADDRESS(MIN(IF(NumRange=MAX(NumRange),ROW(NumRange))),
COLUMN(NumRange),4)

Address


30

=ADDRESS(MAX(IF(NumRange=MAX(NumRange),ROW(NumRange)*
(NumRange<>""))),COLUMN(NumRange),4)

Address


Copyrightofwww.ExcelExpertTraining.com

262

31 =INDEX(Rng,MATCH(MAX(COUNTIF(Rng,Rng)),COUNTIF(Rng,Rng),0))

32

=(MAX((DataRange2<>"")*ROW(DataRange2)))ROW(DataRange2)+1

33

=INDIRECT(ADDRESS(MAX((DataRange2<>"")*ROW(DataRange2)),
COLUMN(DataRange2),4))

34

=INDIRECT(ADDRESS(MAX((DataRange2<>"")*ROW(DataRange2)),
COLUMN(DataRange2)+1,4))

3
5

=SUM(IF(FREQUENCY(IF(LEN(Range1)>0,MATCH(Range1,Range1,0),""
),
IF(LEN(Range1)>0,MATCH(Range1,Range1,0),""))>0,1))

Unique

Copyrightofwww.ExcelExpertTraining.com

263

36 =SUM(1/COUNTIF(A1:A10,A1:A10))

Unique blank

37 =SUM(N(FREQUENCY(A1:A10,A1:A10)>0))

Unique

=ADDRESS(ROW(DataRange2),COLUMN(DataRange2),4)&":"&
38 ADDRESS(MAX((DataRange2<>"")*ROW(DataRange2)),
COLUMN(DataRange2)+COLUMNS(DataRange2)-1,4)

DataRange2
range

data
H7:I25 H7:I17

=RIGHT(A1,LEN(A1)39

MAX(ROW(INDIRECT("1:"&LEN(A1)))
*(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)="
")))

=MID(A10,SMALL(IF(MID(" "&A10,ROW(INDIRECT
40 ("1:"&LEN(A10)+1)),1)="
",ROW(INDIRECT("1:"&LEN(A10)+1))),

Copyrightofwww.ExcelExpertTraining.com

264

B10),SUM(SMALL(IF(MID(" "&A10&" ",ROW(INDIRECT


("1:"&LEN(A10)+2)),1)="
",ROW(INDIRECT("1:"&LEN(A10)+2))),
B10+{0,1})*{-1,1})-1)

=MID(A10,SMALL(IF(MID(" "&A10,ROW(INDIRECT
("1:"&LEN(A10)+1)),1)="
",ROW(INDIRECT("1:"&LEN(A10)+1))),
41 B10),SUM(SMALL(IF(MID(" "&A10&" ",ROW(INDIRECT
("1:"&LEN(A10)+2)),1)="
",ROW(INDIRECT("1:"&LEN(A10)+2))),
B10+C10*{0,1})*{-1,1})-1)


A10


B10



C10

B10

42

=SUM(IF(WEEKDAY(A2-1+ROW(INDIRECT("1:"&TRUNC(B2A2)+1)))=C2,1,0))



A2


B2
(1=Sunday,
C2

Copyrightofwww.ExcelExpertTraining.com

265

2=Monday,...,7=Saturday)

=IF(ROW()-ROW(NoBlanksRange)+1>ROWS(BlanksRange)COUNTBLANK(BlanksRange),"",INDIRECT(ADDRESS(SMALL(
43 (IF(BlanksRange<>"",ROW(BlanksRange),ROW()+
ROWS(BlanksRange))),
ROW()-ROW(NoBlanksRange)+1),COLUMN(BlanksRange),4)))

BlanksRange
NoBlanksRange

44

=SUM(IF(IF(B$5>=F6:F10,F6:F10-F5:F9,$B$5-F5:F9+1)>0,
IF(B$5>=F6:F10,F6:F10-F5:F9,$B$5-F5:F9+1),0)*G5:G9)

FIFO
Progressive Pricing




Stock FIFO
E

Quantity UnitPrice

10

30

Copyrightofwww.ExcelExpertTraining.com

266

60

100

10

9999999

11

1 Part#

ALPHA NUMERIC
portion portion

{=LEFT(A2,
MIN(IF(ISNUMBER(
45

2 ab2

ab

=RIGHT(A2,

MID(A2,{1,2,3,4,5,6},1) LEN(A2) *1),{1,2,3,4,5,6},7))-

LEN(B2))*1

1)}

{=LEFT(A6,
MIN(IF(ISNUMBER(
3 OP30

OP

30

=RIGHT(A3,

MID(A3,{1,2,3,4,5,6},1) LEN(A6) *1),{1,2,3,4,5,6},7))1)}

Copyrightofwww.ExcelExpertTraining.com

LEN(B6))*1

267

{=LEFT(A8,
MIN(IF(ISNUMBER(
4 OP1221 OP

1221

=RIGHT(A4,

MID(A4,{1,2,3,4,5,6},1) LEN(A8) *1),{1,2,3,4,5,6},7))-

LEN(B8))*1

1)}

=INDIRECT(ADDRESS( ROW(MyRange) +INT((ROW() ROW(CxRV))/COLUMNS(MyRange)),


COLUMN(MyRange)+MOD(ROW() -ROW(CxRV),
COLUMNS(MyRange)),4,,"Sheet1"))
=INDIRECT(ADDRESS( ROW(MyRange) +MOD(ROW() ROW(CxCV),ROWS(MyRange)),
COLUMN(MyRange)+INT((ROW() ROW(CxCV))/ROWS(MyRange)), 4,,"Sheet1"))
46
=INDIRECT(ADDRESS( ROW(MyRange) +INT((COLUMN() COLUMN(RxRV))/COLUMNS(MyRange)),
COLUMN(MyRange)+MOD(COLUMN() -COLUMN(RxRV),
COLUMNS(MyRange)), 4,,"Sheet1"))
=INDIRECT(ADDRESS( ROW(MyRange) +MOD(COLUMN() COLUMN(RxCV),ROWS(MyRange)),
COLUMN(MyRange)+INT((COLUMN() COLUMN(RxCV))/ROWS(MyRange)),4,,"Sheet1"))

Copyrightofwww.ExcelExpertTraining.com

268

MyRange M rows N
columns
CxRV

=OFFSET($B$5,MIN(IF(COUNTIF($G$11:G11,$B$5:$GR$10)=0,
ROW($B$5:$GR$10)ROW($B$5))),MOD(MIN(IF(COUNTIF($G$11:G11,$B$5:$GR$10)=0,
ROW($B$5:$GR$10)- ROW($B$5) +(COLUMN($B$5:$GR$10)COLUMN($B$5))/1000)),1)*1000)
47

=INDEX(tbl,MIN(IF(COUNTIF($A$1:A1,tbl)=0,ROW(tbl)MIN(ROW(tbl))+1)),
MATCH(0,COUNTIF($A$1:A1,INDEX(tbl,MIN(IF(
COUNTIF($A$1:A1,tbl)=0,ROW(tbl) -MIN(ROW(tbl))+1)),,1)),0),1)

list of unique entries in an n * m array

48 =AND(NOT(ISNA(MATCH(Range1,Range2,0))))

Range1 Range2

=MMULT(N(ROW(INDIRECT("1:"&ROWS(A)))=TRANSPOSE(
49 ROWS(A)+1-ROW(INDIRECT("1:"&ROWS(A))))),A)
=MMULT(A,N(ROW(INDIRECT("1:"&COLUMNS(A)))=TRANSPOSE

Copyrightofwww.ExcelExpertTraining.com

269

(COLUMNS(A)+1-ROW(INDIRECT("1:"&COLUMNS(A))))))

=OR(A1=2,A1=3,ISNA(MATCH(TRUE,A1/ROW(INDIRECT(
50 "2:"&INT(SQRT(A1))))=
INT(A1/ROW(INDIRECT("2:"&INT(SQRT(A1))))),0)))

prime number

51 =MATCH(TRUE,EXACT("A",MyRange),0)

case-sensitive MATCH

17 = 5x + 3y + 2z
13 = 2x + 4y + z
22 = 3x + 2y + 5z
Put the coefficients of the unknowns in, e.g., A1:C3 (i.e., 5,3,2 in
A1:C1, 2,4,1 in A2:C2, etc.);
52 Put the constants (17, 13, 22) in, e.g., D1:D3;
Highlight, e.g., E1:E3 and array enter (i.e., enter with
Ctrl+Shift+Enter instead of just Enter)
=MMULT(MINVERSE(A1:C3,D1:D3)
and the solution vector (1,2,3) will appear in E1:E3; i.e., x=1,
y=2, z=3 For a set of equations that does not have a solution,

Copyrightofwww.ExcelExpertTraining.com

270

the #VALUE error will appear in E1:E3.

solve a set of simultaneous equations

=SUM(N(MATCH(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1),
53 MID(A1,ROW(INDIRECT
("1:"&LEN(A1))),1),0)=ROW(INDIRECT("1:"&LEN(A1)))))=LEN(A1)

54

=SUM(VALUE(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1))*10
^(ROW(INDIRECT ("1:"&LEN(A1)))-1))

A1:D1 = {1,2,3,4}
55

A5:D5 = {5,6,7,5}
=SUM({1,2,3,4}*{5,7,6,5}) = 57
=SUM(A1:D1*INDEX(A5:D5,5-COLUMN(A5:D5)))

56

=ROWS(iRng)ROW(OFFSET($A$1,,,ROWS(iRng),)).

Copyrightofwww.ExcelExpertTraining.com

271

=IF(T(OFFSET(iRng,ROWS(iRng)ROW(OFFSET($A$1,,,ROWS(iRng),)),,,))="",N
57 (OFFSET(iRng,ROWS(iRng)ROW(OFFSET($A$1,,,ROWS(iRng),)),,,)),T(OFFSET
(iRng,ROWS(iRng)-ROW(OFFSET($A$1,,,ROWS(iRng),)),,,)))

58

=LARGE(IF(MATCH(Rng,Rng,0)=ROW(Rng)MIN(ROW(Rng))+1,Rng,""),N)

Nth largest unique value in a column range

59

=SUM(N(FREQUENCY(IF(lookupRange="specifStr",
MATCH(colRange,colRange,0)), MATCH(colRange,colRange,0))0))

unique

=SMALL(IF(MATCH(TheList,TheList,0)=ROW(TheList),
60

ROW(TheList),""),
ROW(INDIRECT("1:"&SUM(N(MATCH(TheList,TheList,0)=
ROW(TheList))))))-1

Unique item

Copyrightofwww.ExcelExpertTraining.com

272

61

=IF(SUBTOTAL(3,OFFSET(Rge,ROW(Rge)MIN(ROW(Rge)),,1)),Rge,"")

create an array of filtered items in a column list.

=IF(MONTH(DATE(y,m,1))<>MONTH(DATE(y,m,1)62

(WEEKDAY(DATE(y,m,1))-1)+{0;1;2;3;4;5}*7+{1,2,3,4,5,6,7}-1),
"", DATE(y,m,1)-(WEEKDAY(DATE(y,m,1))1)+{0;1;2;3;4;5}*7+{1,2,3,4,5,6,7}-1)

63

=SUM((WEEKDAY(DATE($B$2,$A3,ROW(INDIRECT("1:"&
DAY(DATE($B$2,$A3+1,0))))))=C$1)*1)

C1 A3 B2

64 =SUM(IF(ISNONTEXT(data),1))

65 =SUM(IF(ISTEXT(data),1))

Copyrightofwww.ExcelExpertTraining.com

273

66 =SUM(IF(ISLOGICAL(data),1))

logical

67 =SUM(IF(EXACT(data,text),1))

text

68

=SUM(IF(LEN(data)LEN(SUBSTITUTE(data,text,""))>0,1))

text

=(SUM(LEN(data))69 SUM(LEN(SUBSTITUTE(UPPER(data),UPPER(text),""))))/LEN(text)
=(SUM(LEN(data))-SUM(LEN(SUBSTITUTE(data,text,""))))/LEN(text)

text

70

=INDIRECT(ADDRESS(ROW(Data)+MATCH(MIN(ABS(TargetData)),ABS(Target-Data),0)-1,COLUMN(Data)+ColOffset))

Closest Match

Copyrightofwww.ExcelExpertTraining.com

274

71

=SUM((MATCH(Grades,{"F","D","C","B","A"},0)1)*CreditHours)/SUM(CreditHours)

GPA

72

=ADDRESS(ROW(Data)+MATCH(Target,Data,0)1,COLUMN(Data))

73

=ADDRESS(ROW(Data),COLUMN(Data)+MATCH(Target,Data,0)1)

74

=INDEX(Code,
MATCH(Make&Model,Range1&Range2,0))

2 value lookup

=INDEX(Data, SMALL(IF(Data>0,
ROW(INDIRECT("1:"&ROWS(Data)))),
75 ROW(INDIRECT("1:"&ROWS(Data)))))
IF(ISERR( SMALL(IF(Data>0,
ROW(INDIRECT("1:"&ROWS(Data)))),

Copyrightofwww.ExcelExpertTraining.com

275

ROW(INDIRECT("1:"&ROWS(Data))))), "", INDEX(Data,


SMALL(IF(Data>0, ROW(INDIRECT("1:"&ROWS(Data)))),
ROW(INDIRECT("1:"&ROWS(Data))))))

=IF(ISERR(SMALL(IF(Data<>"",ROW(INDIRECT("1:"&ROWS(Data)))),
ROW(INDIRECT("1:"&ROWS(Data))))),
76 "",INDEX(Data,SMALL(IF(Data<>"",
ROW(INDIRECT("1:"&ROWS(Data)))),
ROW(INDIRECT("1:"&ROWS(Data))))))

=IF(INDEX(Data,ROWS(Data) 77

ROW(INDIRECT("1:"&ROWS(Data)))+1)="", "",
INDEX(Data,ROWS(Data) ROW(INDIRECT("1:"&ROWS(Data)))+1))

=LARGE(Data,ROW(INDIRECT("1:"&ROWS(Data))))
78 =IF( ISERR( LARGE( Data, ROW( INDIRECT("1:"&ROWS(Data))))),
"", LARGE( Data, ROW( INDIRECT("1:"&ROWS(Data)))))

Copyrightofwww.ExcelExpertTraining.com

276

=INDEX( data, SMALL( IF( MATCH(data,data,0) =


79 ROW(INDIRECT("1:"&ROWS(data))), MATCH(data,data,0), ""),
ROW(INDIRECT("1:"&ROWS(data)))))

Unique items in List

80 =SUM(LARGE(Data,ROW(INDIRECT("1:"&n))))

81

=IF(OR(TheName=NameList),"Found","Not
Found")

TheName NameList

82 =SUM(IF(MyData=YourData,0,1))

83

=ADDRESS(MIN(IF(Data=MAX(Data),ROW(Data),
"")),COLUMN(Data))

84 =MIN(IF(Data=MAX(Data),ROW(Data), ""))

Copyrightofwww.ExcelExpertTraining.com

277

row

85 =SMALL(IF(Data=Value,ROW(Data), ""),n)

row n

86 =INDEX(Data,MATCH(MAX(LEN(Data)),LEN(Data),FALSE),1)

87 =ISNA(MATCH(TRUE,ISNA(MATCH(MyList,Master,0)),0))

MyList Master

88 =SUM(1*ISNA(MATCH(MyList,Master,0)))

MyList
Master

89 =INDEX(MyList,MATCH(TRUE,ISNA(MATCH(MyList,Master,0)),0))

MyList
Master

90

=SUM(VALUE(MID(ABS(A1),ROW(INDIRECT
("1:"&LEN(ABS(A1)))),1)))

Copyrightofwww.ExcelExpertTraining.com

278

=MID(A4,MATCH(0,(ISERROR(MID(A4,
91

ROW(INDIRECT("1:"&LEN(A4))),1)*1)*1),0),LEN(A4)SUM((ISERROR(MID(A4, ROW(INDIRECT(
"1:"&LEN(A4))),1)*1)*1)))

92

=INDEX(Data,MATCH(SMALL(ABS(TargetData),1),ABS(Target-Data),0))

93

=INDIRECT(ADDRESS(MAX((ROW(4:503)*
(A4:A503<>""))),COLUMN(A:A)))

column A

94

=INDIRECT(ADDRESS(6,(MAX((TRANSPOSE(
ROW(1:256))*(6:6<>""))))))

row 6

Copyrightofwww.ExcelExpertTraining.com

279

95 =SUM(1*(B6<=Sales))-(SUM(1*(B6=Sales))-1)/2



=RANK(B6,Sales)

96 =SUM(IF($E6&F$5=Date&Category,Amount))

Dynamic crosstabulation

97

=LEN(A1)+1-MATCH(" ",MID(A1,LEN(A1)+1ROW(INDIRECT("1:"&LEN(A1))),1),0)

space

=SUM((SUBTOTAL(9, INDIRECT(ADDRESS( ROW(E3),COLUMN(E3)


98 )&":"& ADDRESS( ROW(E3),
ROW(INDIRECT(COLUMN(E3)&":"&COLUMN(AI3))) )))<=B3)*1)+1

Cumulative Sum C3:G3


B3

99

=INDEX( ,SMALL(IF( <0,),


),1)

Copyrightofwww.ExcelExpertTraining.com

280

=INDEX(Product, SMALL(IF((Type=YourType) *
(Account=YourAcct) * (Date>=YourDate) * ROW(INDIRECT("1:"&
100 ROWS(Product)))<>0, (Type=YourType) * (Account=YourAcct) *
(Date>=YourDate) * ROW(INDIRECT("1:"&ROWS(Product)))),
ROW(INDIRECT("1:"&ROWS(Product)))),1)

=INDEX(Type, LARGE(IF( NOT(ISBLANK(Type)),


MATCH(Type,Type,0)) * (IF( NOT(ISBLANK(Type)),
101 MATCH(Type,Type,0))=ROW( INDIRECT("1:"&ROWS(Type)))),
ROW(INDIRECT("1:"&SUM( IF( NOT(ISBLANK(Type)),
1/COUNTIF(Type,Type))))) ) )

Unique List

102

=INDEX(Product, MATCH( MAX(COUNTIF(Product,Product)),


COUNTIF(Product,Product), 0),1)

Copyrightofwww.ExcelExpertTraining.com

281


Excel (Reference)

Conditional Formatting, Data Validation,

Advanced Filter, Pivot Table,
Visual Basic for Applications
(VBA)
Insert Delete row column






VBA
VBA







Insert
row



column
=VLookup( IDCode, A:D, 3)

A:D



Dynamic Cell
Dynamic Range Offset, Index, Indirect, Address



(Dynamic Cell)




Excel
Offset



Offset

Copyrightofwww.ExcelExpertTraining.com

282


2
2, 3, 4, 5

10, 20,
2 30






C2:F2
Top

B3:B5
Left

C3
=Top*
*Left

copy
C3 paste


C3:G7 =Top*
*Left
C3:F5


Top
p Left


To
op Left error #VALUE
E!

Top Le
eft D
Dynamic Ra
ange
Offset
Top
T

Left



Top Le
eft Dynamic
D
Ceell

C3
1.
2. Formulas > Name M
Manger
3.
Top =C$2
2 Left =$B3

Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

283

Top

Top =C$2 Exce


el
row 2

Lefft =$B3
Left

column B
Top *Left

Top
p Left



row
w

Cut

B2:G7 Cut row 2:7


row
w

Insert rrow

Top row 2
Top
T


row 2

colu
umn
coolumn


Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

284




C3:G7
Home > Conditionaal Formattiing
Usse a formu
ula to deterrmine whicch cells to format
f


=MOD(C$2,2)=1

C$
$2


C3
3:G7



$
2

Excel

row 2

$
C2,, D2, E2, F2, G2
2, 3, 4, 5, 6


2 1

Cond
ditional Fo
ormatting

3 5


C$2
C Dyynamic Celll
Conditiona
al

Formattting


column

Da
ata

Validattion

Allow Custom
m

Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

285

Table

Insert//Delete






Excel




colu
umn


Exce
el 2003


Daata > List



Excel
Table
2010

T
(

Data Table)
T

Insert >
Table
Home > Format as Table
Excell



, Format, Conditional
Formattting, Data Validation
n,
Pivot Table
T

Rangee Name

Table
T



Range
R
Nam
me

2


(

MyD
Data, Id, Name,
N
Amo
ount

Co
ost




)
Table

Range Name


N



Insert
My
> Table
e Exce
el =$B$2:$E$
=
$3

Taable2
table h
has headerss
OK Range Na
ame

Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

286

Tab
=$B$3:$E$3

(
ble2

1

Table)
Rang

ge Name




, Foormat,
Conditiional Formatting, Datta Validatio
on,
Pivott Table

Table

Structure
ed Referen
nce
=SUM((Table2[Co
ost])
Cosst Table

Strructured Reference
R





=S
SUM(Table
e2[Cost])
=SUM(S
Sheet1!$E$
$3:$E$7)
Table

Table
T

Table >
Converrt to range

Inssert > Table




=SUM((Sheet1!$E
E$3:$E$7)
=SUM(Tab
=
ble2[Cost])

Range Nam
me




Structu
ured Refere
ence





Table

Ran
Id, Nam

nge Name
me, Am
mount
B3:B4,
C3:C4, D3:D
D4

row 4

Table

Ran

2


nge Name

Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

287



Delette Row

Range Na me


Table

IF

Choo
ose

VLLookup, Ma
atch, Offseet,


=VLOOKU


UP($H$3,M
MyData,2,0
0)
MyData
Range Name

VLooku
up


IF
F Choo
ose

MyData






)

(

ClasssA, ClassB
B, ClassC

Classs A, B, C
Class




B100

B14

Name
Amoun
nt

IF(Class=""A", ClassA
A, IF(Class=
="B", ClasssB, ClassC) )

Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

288

Class
VLooku
up


C14
=VLOO
OKUP( $B$
$14, IF(Cla
ass="A", C
ClassA, IF(C
Class="B", ClassB, CllassC) ), 2,
2 0)

D14
=VLOO
OKUP( $B$
$14, IF(Cla
ass="A", C
ClassA, IF(C
Class="B", ClassB, CllassC) ), 3,
3 0)


Class




B14
Classs

=Left(C14
4)
B10



Class

IF
IF



Choosee IF


A,

1,
1 2, 3

A B, C



Cl ass 1, 2,
3
B 10

Class

B
B14
Naame Amount
A

CHOOSE(Class,C
Class1,Classs2,Class3)
VLoookup

Cllass

C14
=VLOO
OKUP( $B$
$14, CHOO
OSE(Class,,Class1,Class2,Class3
3), 2, 0)
Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

289

D14
=VLOO
OKUP( $B$
$14, CHOO
OSE(Class,,Class1,Class2,Class3
3), 3, 0)

B14

Class



Class

Cla

F10:G12

assTable
column

Id


VLookup Approachiing
Class
Match =VLOOKUP(B14,ClasssTable,2) B1
10

Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

290

Inde

ex

Ind
dex



row column
c

c


=
=Index(Cla
ass1,3,2)

Class1

row 3 column 2


ro
ow col

=Index(CusttId1,3)

a003
3


3
CustId1 ( CusttId1


Sin
ngle Colum
mn
B3:B7)

Ind
dex



If Choose
C

g
C11

b002

B111
=INDE
EX( (Class1
1,Class2,Class3), TrN
Num, 2, Class)

(Claass1,Class2
2,Class3)
3

TrNum


b002
b



B11
=MATCH(B
B11, CHOO
OSE(Class, CustId1,C
CustId2,CusstId3), 0)

column

Class
ClassTab
ble
=VLOOKUP(B11, Cla
assTable, 2
2)

CHOOSE(C
Class, CusttId1,CustId
d2,CustId3)

Class
Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

291


Index Arrayy

ro
ow column 0
=Indexx(Class1, 0,
0 3)
row column
n 3
Amoun
nt ={10;20;30;40;50}}
=Indexx(Class1, 3,
3 0)
column row
w 3
a003 ={"a003","c
c",30}

Offs

set

(Dyn
namic Ra
ange)

VLLookup Index
x


IF Choose

VLo
ookup
Index


Ta
able



deleete row



Offfset

Offset
O

B3:D7
=O
OFFSET($B
B$3,0,0,5,3
3)

Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

292

$B$3

0 row
0

row
$B$3

0
column
0

column

$B$3

5

5 row

3

3 column



(Dynamic Range)







Offset
1
1. CountA($B:$B)-1
column B


B2 Id
2. CountA($B$3:$B$10000)




row 10000
CountA column


column

column


Array {=MAX(IF(B:D<>0,ROW(B:D)))-MIN(IF(B:D<>0,ROW(B:D)))}

Array { =MAX(IF(B:D<>0,ROW(B:D)))} row

Array { =MIN(IF(B:D<>0,ROW(B:D)))} row

Array Ctrl+Shift+Enter
Enter


column B:D

Copyrightofwww.ExcelExpertTraining.com

293

=OFFSET($B$3,0,0,5,3)


=OFFSET($B$3,0,0, CountA($B:$B)-1, 3)


=OFFSET($B$3,0,0, , 3)
Offset
Dynamic Range error
#VALUE!


F2 F9

Array
={"a001","a",10;"a002","b",20;"a003","c",30;"a004","d",40;"a005","e",50}


Esc

Formula Bar


=OFFSET($B$3,0,0, CountA($B:$B)-1, 3) F5 Enter
Excel
Offset =B3:D7

Esc

Offset
$B$3 $B:$B
Absolute Reference

Formula Name Formulas > Define Name


Formula Name




VLookup, Match, Index
Range Name

Copyrightofwww.ExcelExpertTraining.com

294


Offset

row, co
olumn,

=OFFSET(($B$3,2,0) B
B5

=OFFSET(($B$3,4,2) D
D7

=OFFSET(($B$3,2,0,1
1,3)
B5:D5

=OFFSET(($B$3,4,0,1
1,3)
B7:D7

=OFFSET(($B$3,2,0,2
2,3)
B5:D6

=OFFSET(($B$3,0,0, CountA($B
B:$B)-1, 1)) B3:B7
B

=OFFSET(($B$3,0,1, CountA($B
B:$B)-1, 1)) C3:C7
C

=OFFSET(($B$3,0,2, CountA($B
B:$B)-1, 1)) D3:D7
D

=OFFSET(($B$3,0,0, CountA($B
B:$B)-1, 2)) B3:C7
B

=OFFSET(($B$3,0,1, CountA($B
B:$B)-1, 2)) C3:D7
C

=OFFSET(($B$3, Cou
untA($B:$B
B)-2,0,1,3) B7:D7
B

Offset



B3


ro
ow colu
umn

Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

295

Text


(D
Dynamic Range)
Offset



B2:F155

=S
SUM(B2:F15)


B2:F15

In
nsert/Delete
e Row Column

Sum
S
Inserrt/Delete R
Row Column

Copyy



I2
I3 =Ceell(Addresss,cell)


(Firstt)


(Lastt)
$B$2 $F$15






I4
=FirsstCell&":"&
&LastCell
$B
B$2:$F$15

Textt




direct
Ind

Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

296




I6 =SUM(INDIRECT
T(I4))

=INDIR
RECT($I$4
4)
Formu
ula Name


Su
um

Firrst Lasst


First Last

C5 E9

Sum

C5:E9
9

=
=Cell(Add
dress,cell)





IF, Ch oose, Inde
ex,

Offset


=CELL("Ad
ddress",INDEX(MyNu
um,FirstRow
w))

INDE

2
EX(MyNum,FirstRow))
Cell

MyNum
22


B3

Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

297


VLookup
p, Match, IIndex,

Excel

D
Data Valida
ation

Conditiona
C
l Formattin
ng

CounttIF

Excel




B3:B15
B



Data > Data
D
Valida
ation > Datta Validatio
on

A
Allow Custom
C



=COUNTIF($B$3:$B
B$15,B3)=11

Formulla


$
B3
3





Excel

Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

298



B3:B15
5

Home > Conditio
onal Formatting > Neew Rule
Use a form
mula to
mine which cells to format =CO
OUNTIF($B$3:$B$15, B3)>1
determ
True

CountIIF


Data Validation =CO
OUNTIF($B
B$3:$B$15 ,B3)=1


Con
nditional Fo
ormatting

1
1

=COUN
NTIF($B$3:$B$15,B3
3)>1 Data Valid
dation

1
Conditio
onal Formaatting




1
Data V
Validation


Conditiona
C
al Formattinng


Data V
Validation


copyy

Conditional
C
Formatting

Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

299



B
B3:E20
Home > Conditio
onal Forma
atting > Ne
ew Rule


Usse a formu
ula to deterrmine whicch cells to format
f

=$$C3=$G$3


G
G3




=$C3=$G
G$3

$G$3

C3

ID
$C3



colu
umn C

Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

300


Mu
ultiple M
Match
VLLookup Match
h






Data
> Adva
anced Filter







Mu
ultiple Matcch
Mu
ultiple Matcch

a001

1, 6, 9, 1 1, 15

a001

Multiple
M
Maatch {=SM
MALL(IF(ID=G3,Num)),Num)}


L3:L12
2 Array

Range Name N

Num, ID, Name,


N
Amount


B3:B20
0, C3:C20, D3:D20,
E3:E20
0 G3

Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

301


{=SM
MALL(IF(ID=G3,Num)),Num)}





Step1
S

Step3
(


)
Step1 :

I3:I20

=ID
D=G3

Ctrl+Sh
hift+Enter
{=IID=G3}

True



a001
Step2 :
True
T
S
Step1
Num
=IF(I3:I2
20,Num)
Cttrl+Shift+E
Enter
J3:J20

{=IF(I3:II20,Num)}


Tru
ue

1, 6, 9, 11
1, 15



Step3 :

S
Step2


Small
K3:K20
0

=SMALL
L(J3:J20,Nuum)

Ctrl+Sh
hift+Enter
{=S
SMALL(J3: J20,Num)}}

Ste
ep1 Step3

Multtiple Matchh L3:L12


L
{=SMA
ALL(IF(ID=
=G3,Num),N
Num)}



L3:L20
row 20
0
Sttep1 Step
p3

row
L3:L12
2 10 ro
ow

Index

Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

302


Unique
U
Ittem
Unique
e Item



Unique Item
Multiple
M
Match



ID C3:C20
ID U
Unique Item
m

1, 2, 3, 4, 5, 7,
7 10, 16

Array I3:I12 { =SM


MALL( IF(M
MATCH(ID&
&"",ID&"",0
0) = Num, Num), Num)}


I3::I12
Ctrl+SShift+Enter

I3:I12
2

U
Unique Item
m )

Step1 : MAT
TCH(ID&""",ID&"",0)

ID

C20


ID&""

Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

303

Step2 :
Step1 Num



True
U
Unique Item
m
Step3 :
Step2

True
IF(MAT
TCH(ID&"",ID&"",0) = Num, Nu
um)
Step4 :

Step3

Sm
mall
ID

Unique
Inde
ex

Unique
e
Data >
Advancced Unique reco
ords only

D
D3 =B3

Uniq
que Item


D
D4
Array {=INDEX(I
{
ID,MATCH(0,COUNTIF($D$3:D
D3,ID),0))}
copy



http://w
www.get-d
digital-help
p.com/2009
9/03/30/ho
ow-to-extra
act-a-uniquue-list-and
d-theduplica
ates-in-excel-from-on
ne-column//

Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

304

Excel






insert row delete row




SubTotal Filter Custom Views

Data > SubTotal




Data > Consolidate




Array SumIF DSum


Data >
What-if Analysis > Data Table

Insert > Pivot Table


Copyrightofwww.ExcelExpertTraining.com

305


Sum
S

SubTotal


Sum
m


Sum
m





Sum

B12

B
B2:B11
=SUM
M(B2:B11)

55


B2:B6

row
row 6 row 7

=SU
UM(B2:B6)
B7

15
Sum


55
77

Sum
m B
B7

Sum


=SU
UM(B2:B11
1)


=B
B2+B3+B4+
+B5+B6+B
B7+B8+B9
9+B10+B11



row




Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

306

Sum SubTottal


Filter Cu
ustom Viiews
SubTotal
Sub
bTotal

SubTotal
S


To
otal

Sub



Sub
bTotal
11

=SubT
Total(

1 111

101

101
SubTo
otal

Average

102
SubTo
otal

Count

103
SubTo
otal

CountA

109
SubTo
otal

Sum

SubTotal

SubTottal
Sum



SubTotal
S

Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

307

B7
B B13
3 Su
ubTotal

B2:B6
B2
2:B12
B13
3 =SUBTOTAL
L(109,B2:B
B12)

B2:B12
B
B7

B2:B
B6 SubT
Total
B13

B
B7

55
row

SubTota
al


w/column hide Data
> Filterr
SubTotal


(V
Visible Cellss Only)

(Excel
Excel
E
2003
3
1 - 11

Ex
xcel 2003
101 111

Filtter
row//column

Filter
F


V
View > Cusstom Viewss > Add

Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

308



View
w > Custo m Views

Views



Show



SubT
Total


(
Custo
om Views Print
P
Setting
)

D
> Su
ubtotal
Data
Data > SubTotal





SubTottal



Outline

Custom Views

Data > Suubtotal


Data > Sort

Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

309

At eacch change in:


Heade

er

Header

Use fu

unction:
Sum
m

Add subtotal
Header

s
to::
Field

OK

Row


Subtotal
S

Subtotal
Subtotal
S

Data > Subtota


al
At eaach change in:

He
eader



Replace
e current subtotals
s


OK

Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

310

Outline


Outline

Copy Visib
ble
Cells



F5 > Sp
pecial >
Visible
e cells only
Copy
Passte


Ou
utline


Excel SubTotal
S


Remove
e All

Outline



Data > Group

Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

311

D
> Co
onsolida
ate
Data


Division 1 Divvision 4

Data
R
> Conssolidate



Reference
Add
d

A
Add

(

Use laabels in

Crate linkss to source

e data

Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

312

E
Excel




link


marker


link

1.

2.

marker







3.
=
formula bar


enter
4.
5. marker
link


linkk



1.

2. Shift

E
Edit > Cop
py Picture
O
OK

3.
Paaste


4. formula bar


=
5.


copy picture
linnk

6. Enter

Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

313

Exxcel
link

link


PicTable

1.


ChoosePic
Formulass > Define Name
2.
Formula Name
Refers to: =IND
DEX(PicTable,1,Sheet1!$A$1)

3.

Home > Copy as Picture


4.

Paste

copy
5. Formula
a Bar
=Choo
osePic
Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

314

2
6.

A1
2

copy

7.

Cop
pyrightofww
ww.ExcelExp
pertTraining.ccom

315


...

Excel






Excel

Excel ...




!!!

Excel Excel




1.
2.


3. Format


Excel

A1






Excel

A1








1
100 123 100
Copyrightofwww.ExcelExpertTraining.com

316

100 100






1.

1 123

2.
A ABC
( Excel 2010 1 2
)
3.

4.

link


link

Cache Data
=VLOOKUP(A1,[Input.xls]Sheet1!$B$2:$H$200,2)


Sheet1 B2:H200 Excel
Input.xls






Cache Data

Cache Data



VLookup

Format




Excel

Copyrightofwww.ExcelExpertTraining.com

317

Excel

Extend data range formats


Excel Excel Options

and formulas


3

3
4


4


(
copy 4 5

3 4 5 3 4

5 )



Excel


Excel





Excel



Excel @ The Maximum Speed
http://www.excelexperttraining.com/extra/tactic/maxspeed.html







Copyrightofwww.ExcelExpertTraining.com

318



Excel
Access



Excel Access

Excel Access

Excel



Excel



Excel




Access

Excel

Excel


1.

2.



3.




4.


5.



6.
Excel


7.

8.




9.



10. VBA
VBA VBA




Copyrightofwww.ExcelExpertTraining.com

319


Excel
Excel


Excel



Excel

Excel


Excel






()
3

Excel



Data Lookup





Format


Format

Copyrightofwww.ExcelExpertTraining.com

320

Index Offset
Excel


(Range name)


(


)



VBA
Excel


VBA

row

?



Excel

Copyrightofwww.ExcelExpertTraining.com

321

link



link
Indirect

link


link Change Source

Copyrightofwww.ExcelExpertTraining.com

322







(

D1:D55,000 Excel 2003 Pentium D
3.0 GHz)

SumIF

SumIF
4 / 2,984 KB
=SumIF(IDRange,ID,NumRange)

SumIFArray
38 / 6,089 KB
{=Sum(IF(IDRange=ID,NumRange))}

SumArray
47 / 5,547 KB
{=Sum((IDRange=ID)*NumRange)}

SumProduct
--
44 / 2,987 KB
=SumProduct(--(IDRange=ID),NumRange)

SumProduct

50 / 2,986 KB
=SumProduct((IDRange=ID)*NumRange)

SumIF

2


SumIF

SumIFArray
2 23 / 9,716 KB
{=Sum(IF(IDRange=ID,IF(KeyRange=Key,NumRange)))}

SumArray
2 39 / 8,633 KB
{=Sum((IDRange=ID)*(KeyRange=Key)*NumRange)}

SumProduct
--
2 30 /
=SumProduct(--(IDRange=ID),--(KeyRange=Key),NumRange)
5,168 KB

SumProduct

2 33 /
=SumProduct((IDRange=ID)*(KeyRange=Key),NumRange)
5,165 KB

Copyrightofwww.ExcelExpertTraining.com

323

SumProduct

2 42 /

5,166 KB
=SumProduct((IDRange=ID)*(KeyRange=Key)*NumRange)

SumProduct
1
2 50 /
=SumProduct((IDRange=ID)*1,(KeyRange=Key)*1,NumRange)
5,171 KB

VLookup VS Match

VLookup Approaching Match


1 / 2,979 KB

(Not Available)
3
=VLookup(ID,DataRange,2)

Match Approaching Match


1 / 2,976 KB

(Not Available)
1
=Match(ID,IDRange)

VLookup Exact Match 2,981 KB

(Not Available)
7
=VLookup(ID,DataRange,2,0)

Match Exact Match 2,979 KB

=Match(ID,IDRange,0)

Excel
=1+2+3+4+5


=A2+5 A2
=1+2+3+4

Copyrightofwww.ExcelExpertTraining.com

324



RAM

Excel



10,000 column 1 row
Excel 2007

Excel





USB Drive, CD, DVD,










Copyrightofwww.ExcelExpertTraining.com

325

Microsoft Excel

Excel



row column

Excel





Excel

Excel



1. Excel

2.
3.


4.



5.

6.
Excel


7.

Excel

Copyrightofwww.ExcelExpertTraining.com

326

Fist-in First
out
(Material Requirements Planning)

(Feasibility Study)


(

)


Excel
SubTotals Pivot
Table


2





1.

(
)
2.



Copyrightofwww.ExcelExpertTraining.com

327

3.



Excel




4.










7
8:00 10:00 .
(8:00-10:00)
(8:30-9:00) (7:0012:00)
(7:00-9:00) (9:0012:00) (6:00-7:00) (11:00-12:00)
7
5.




6.


Excel





Google
7.





Excel






Copyrightofwww.ExcelExpertTraining.com

328


Excel

















link


copy




row column

Copyrightofwww.ExcelExpertTraining.com

329

2 5 1 5





(C2:F2) (B3:B7)




C3:F7


C3

=C$2*$B3
copy paste
C3:F7

1 1
1




Lookup










cut






7:00-9:00 .


8:00-10:00 .
1

9:00 .
8:00 .
1 (8:00-9:00)

1. (8:00-10:00)
2.
(8:30-9:00)
Copyrightofwww.ExcelExpertTraining.com

330

3. (7:00-12:00)
4.
(7:00-9:00)
5. (9:00-12:00)
6. (6:00-7:00)
7. (11:00-12:00)


H4 = MAX( 0, MIN(F4,D4) MAX(E4,C4) )

MIN(F4,D4) job (
)

MAX(E4,C4) job (
)

MIN(F4,D4)-MAX(E4,C4)

MAX(0,xxx)

0

= MAX(0,MIN(F4,D4)-MAX(E4,C4))


IF

IF IF
7

Copyrightofwww.ExcelExpertTraining.com

331




Excel

Excel





=MID(CELL("filename"),FIND("[",CELL("filename"))+1,FIND("]",CELL("filenam
e"))-FIND("[",CELL("filename"))-1)

=MID(


[,
)

Copyrightofwww.ExcelExpertTraining.com

332

B7



1. A1 =CELL("filename")

drive



2. B3 B4 =FIND("[",$A$1) =FIND("]",$A$1)

[ ]

3. B5 =MID(A1,B3+1,B4-B3-1)

Copyrightofwww.ExcelExpertTraining.com

333

= MAX(0,MIN(F4,D4)-MAX(E4,C4))



6:00-24:00 .

8
6:00, 8:00, 10:00, 12:00, 13:00, 17:00, 19:00,
22:00
8:00, 10:00, 13:00, 17:00


OT 1.5












E5:L5


B6:D10

Copyrightofwww.ExcelExpertTraining.com

334



E5:L5


(To) E2:L3

(From)







B6:B10



(Start) (Stop)
Job
C6:C10 D6:D10
E6:L10 =MAX(0,MIN( E$3, $D6 ) - MAX( E$2, $C6 ))


E6
copy paste
E6:L10


0

Format hh:mm;;


(OT)


OT
N6:O10
Q4 R4
Q6:R10

B6:B10, C6:C10, D6:D10, E5:L5
1.



E6:L10
2.

E6:L10 E6
paste




3. E2:L3



Copyrightofwww.ExcelExpertTraining.com

335

4.

5.

Q6:R10





6. Job B6:B10


Vlookup
C6:D10 Data > Table

Job



7.


copy

1.

Push

Pull
2.



3. Job

Job

Job Job

4.

Excel
(MRP)


Excel
download
http://www.excelexperttraining.com/extreme/files/timeplan/timeconsu
me.xls

Copyrightofwww.ExcelExpertTraining.com

336


Copy

Module
2
Module
(Single Module) Module (Compound Module)

Module
Excel


Module


Excel Module



Module

Copyrightofwww.ExcelExpertTraining.com

337

Module
Module





Excel
Module
Module



Module

Module

Module


Excel Visual Basic

Module

1.


2.
Excel







3.


Single Module
Single Module
Single


Excel Excel
Excel


Excel

12
12
12



Copyrightofwww.ExcelExpertTraining.com

338

Single Module




3
Input
1.

Input



2.
Input

Index
Input

Indirect
Input


3.

Copyrightofwww.ExcelExpertTraining.com

339


Single Module

(Download
www.ExcelExpertTraining.com/extreme/files/database/singlemodule.xls)

Excel


3 case case


3
case
3

case

Range Name MyData) column
I3:K6 (
case1
case

I3:I6
column column
case

case


Index Index

F3:F6 Array ( F3:F6



Ctrl+Shift+Enter


)

Copyrightofwww.ExcelExpertTraining.com

340

=INDEX( MyData, 0, CaseNum )

MyData I3:K6
0
Index Row
1, 2, 3
CaseNum F2
Index
Input Case1, Case2, Case3

CaseNum
F3:F6

link

D3:D9

case Data
Table 1 Row Input Cell CaseNum

H11:K18

Data > Table F2
CaseNum Row Input Cell


I11:K11 1, 2, 3 case


H12:H18 link
D3:D9

Data Table
case

Excel
Excel
Copyrightofwww.ExcelExpertTraining.com

341

1, 2, 3 F2 CaseNum
Index


case



I12:K18 case


Data > Table ( Data > Table Index
Data > Table
Excel

)

Copyrightofwww.ExcelExpertTraining.com

342

Single Module Input



(Calibration)














copy



































Single Module


3
Input

1.

Input


2.
Input


Index
Input

3.

Copyrightofwww.ExcelExpertTraining.com

343


2





( Download

www.ExcelExpertTraining.com/extreme/files/analysis/uncerdbf.xls)

E2:E21 column

column


DataRange


C2:C21 Index


row
1-20 Column D
=INDEX( DataRange, D2, CaseNo )

DataRange

E2:N21
D2 row
row 1

CaseNo
link

Copyrightofwww.ExcelExpertTraining.com

344


B4
CaseNo Index

column C

Uncertainty Budget
B4 Data > Table



VBA

For i = StartNum To StopNum
Range("CaseNo") = i
Calculate
ActiveWindow.SelectedSheets.PrintPreview
Next i

StartNum
Case

StopNum Case


CaseNo
For Next Loop i
(Print
Preview)
Print

Copyrightofwww.ExcelExpertTraining.com

345

3

Single Module



Excel













Excel









www.ExcelExpertTraining.com/blogs/ EWorld 2551


Single Module

1.





2.



Excel


Copyrightofwww.ExcelExpertTraining.com

346












3.



copy





4.
















Data Table
Single Module

Single Module
()

(Download
www.ExcelExpertTraining.com/extreme/files/database/singlemodule.xls)



Excel

case

case
Case1, Case2, Case3


F3:F6

Case 1, 2, 3

Copyrightofwww.ExcelExpertTraining.com

347






SheetModule

1. F3:F6

Case1, Case2, Case3
2. F2


1, 2, 3


CaseNum case







F2 Case =Case&$F$2
( F2 2
=Case&$F$2
Case2)
3. F3:F6
=INDIRECT("Case"&$F$2&"!"&ADDRESS(ROW(),COLUMN()))
3.1. "Case"&$F$2&"!" Case2!
3.2. ADDRESS(ROW(),COLUMN())
F3
row column




Row() 3 Column() 6 Column F
Column 6 ADDRESS(3,6) $F$3
$F$3
3.3.
Case2!


"Case"&$F$2&"!"&ADDRESS(ROW(),COLUMN())
"Case2!$F$3"

"Case2!$F$3" 200
3.4. Indirect

4.
Indirect F3:F6
D3:D6



Margin


Single Module


1.


Ctrl Sheet Tab


Copyrightofwww.ExcelExpertTraining.com

348


Shift




[Group]











[Group]



[Group]



Copy

2.

[Group] Ctrl Shift






Home >
Fill > Across Worksheets Excel 2003 Edit > Fill > Across Worksheets

3.

=sum(

Enter


Shift

=SUM(Case1:Case3!F3)
F3


Case1 Case3

=Case1!F3+Case2!F3+Case3!F3


4.




Sheet1,

=sum('*'!f3) 3
Sheet2, Sheet3
Sheet1
=SUM(Sheet2:Sheet3!F3) Sheet2
=SUM(Sheet1!F3,Sheet3!F3) Sheet3
=SUM(Sheet1:Sheet2!F3)

5.

Hide Row/Column




View > Custom Views > Adds
View






Custom View




View >




View

Custom View


View Print Settings Filter Settings




6.

) Function VBA
=GetSheetName(


Function GetSheetName(x)
GetSheetName = Sheets(x).Name
End Function

Copyrightofwww.ExcelExpertTraining.com

349

Single Module

1. Indirect F3:F6 =Case1!F3, =Case1!F4, =Case1!F5,



Case1
=Case1!F6
link

(Download
www.ExcelExpertTraining.com/extreme/files/database/singlemodulelink.zip)

Case1, Case2, Case3

2. Move


Case1 Move or Copy
(new book) OK
Case1




Case2 Case3

Case1, Case2, Case3



3.

SingleModuleLinkFilesCase1.xls, SingleModuleLinkFilesCase2.xls,
SingleModuleLinkFilesCase3.xls


SheetModule link

F3:F6
link =[SingleModuleLinkFilesCase1.xls]Case1!F3, =
[SingleModuleLinkFilesCase1.xls]Case1!F4, =
Copyrightofwww.ExcelExpertTraining.com

350

[SingleModuleLinkFilesCase1.xls]Case1!F5, =
[SingleModuleLinkFilesCase1.xls]Case1!F6

4.
Case2 Case



link




( )

Office > Prepare > Edit Links to Files Excel 2003 Edit > Links

Change Source
5.


OK > Close

Copyrightofwww.ExcelExpertTraining.com

351



link
1.






Case1,
2.
Case2, Case3
Change Source Excel link







Excel


3.
link
link



Excel

(
Excel )
Folder Save
4. Save

Folder
Save (
Save Save )

Copyrightofwww.ExcelExpertTraining.com

352

Compound Module
Excel


IT






Excel

VBA (Visual Basic for Applications)




Excel

























....





Excel



Excel



Excel



Excel

(-
)

Copyrightofwww.ExcelExpertTraining.com

353


Excel Compound

Module


(-
)






Compound Module

Compound Module

Compound Module

Excel



Excel


(Simple Compound Module)
(Dynamic Compound Module)

Copy Paste


Absolute
$A$1)

A1)
(
Relative (

Mixed Column
$A1)

(

$A1 Paste
Column





$


$
Copyrightofwww.ExcelExpertTraining.com

354


Copy
Compound Module

$
Module



$

$

Excel 2007 Home > Find & Select > Replace


Excel 2003 Edit > Replace


$

Compound Module
Download
www.ExcelExpertTraining.com/extreme/files/database/CompoundModule.xls


SimpleCompound

A, B, C, D (ProductName B4:B7)



A


4
(

C4:F4)
20
1

10 30
20
2, 3, 4

A, B, C, D

8
A, D, C, B (


L4:L6



11
8
3






Copyrightofwww.ExcelExpertTraining.com

355

A
Gantt Chart Process 2


D Process 2
8:30
D Process 1 8:40



D Process 2
D Process



C B Process 2
2

Compound Module



B12:Z15



B12


C13:F13


(Time Consumed) Time Consumed Table

=VLOOKUP($B12,TimeConsumedTbl,C12+1,0)


8:00 C10


Start Time Stop Time
C14:F15
Copyrightofwww.ExcelExpertTraining.com

356



Compound Module


D14
=MAX(D10,C15) D10

MAX
Module (B12:Z15)

D10
$


Module
2 Stop Time Module
Stop Time Module (D10 vs C15)






Module B12:Z15

Copy B12:Z15 Paste


Module

Module

Module 1 row

=MAX(D10,C15) Module Stop Time row
Module

Copyrightofwww.ExcelExpertTraining.com

357

Compound Module
Dynamic
Module

(Bill of Materials : BOM)



Dynamic

A 1 ( Unit = 1 )
B

2 C 3 B D 2
E 2 C E 2 F 2
G 1 D 2
F

LT Lead Time

A

1 (

) B, C, D, E, F, G
2 , 1 , 1


, 2 3 (

. (
))

(Material Requirements
Planning - MRP)


A


B C

G
B

Copyrightofwww.ExcelExpertTraining.com

358

LT
Excel MRP

Parent Child


A



Parent
B C Child B Parent
Parent
D E Child


Child

DynamicCompound
CompoundModule.xls

Compound Module

B6:P7

Item
Column B, C, E, F
B6

Parent


Child
C6
E6 F6
Lead Time

Module

Copy Module B6:P7 Paste
Child->Parent


(B->A, C->A, D->B, E->B,
E->C, F->C, G->F, D->F)
Column B, C,
E, F Module


Column H:P




Copyrightofwww.ExcelExpertTraining.com

359

row Module (Last Row

of Module) Column D

row Module

Module Parent
Module
Child


Row 14 E
C C14 D14
C
Parent
9 =MATCH(C14,B$1:B$1001,0)+1 Match
C 8
C
B1:B1001
1
Row 9 row Module (Last Row of
C
Module)
Child

9 D14
150 N9
N14 =INDIRECT(ADDRESS($D14,COLUMN()))*$E14
E 2 ( E14 = 2) E
C 1

300 (=150x2) E

(LT) 2

E 5
7
=INDIRECT(ADDRESS($D14,COLUMN())) N14

Row Column D14 Row Column()


Column N
Address(9,14)
$N$9
Indirect($N$9) N9


DynamicCompound

Module




MRPModule

Module

Copyrightofwww.ExcelExpertTraining.com

360

Module Copy Paste




Child

Parent 3 ( D20:D22) Module Child


MRP
(-
)
136
Compound Module

Download www.ExcelExpertTraining.com/extreme/files/database/

CompoundModuleMRP(Ans).xls

Excel


(-
)

Copyrightofwww.ExcelExpertTraining.com

361

CompoundModuleMRP(Ans).xls Compound

Module
2



Module





Compound Module


Excel










Excel Excel






Copyrightofwww.ExcelExpertTraining.com

Copyright
XLSiam.com














XLSiam.com









20 2556

You might also like