You are on page 1of 20

Excel Formulas

PURNA CHANDRA RA

NDRA RAO P

Text 1
Text 2
Text 3
Text 4
Text 5
Text 6
Text 7
Text 8
Text 9
Text 10
Text 11
Text 12
Text 13
Text 14
Text 15

10
20
30
40
50
60
70
80
90
100
110
120
130
140
150

Text 1
Text 2
Text 3
Text 4
Text 5
60
70
80
90
100
Text 11
Text 12
Text 13
Text 14
Text 15

To get the LAST text value in a list


1

Text 15

=LOOKUP(REPT("z",255),A:A)

Use of REPT function


REPT("z",255) -> A string consisting of 255 "z"s is considered the largest string Excel c
To get the LAST numeric value in a list
2

150 =LOOKUP(9.99999999999E+307,B:B)
9.9999999999999e+307 is the largest number that you can enter in Excel
To get the LAST value in a list
If a list contains both alpha and numeric values

Text 15

=INDEX(C:C,MAX(MATCH("zzzzzzzzzz",C:C),MATCH(9.9999E+307,C:C)))
MATCH("zzzzzzzzzz",C:C) -> returns the position of last text value

MATCH(9.9999E+307,C:C) -> returns the position of the last numeric value


now using MAX we will get the maximum value
Now to get the last value we used INDEX function.

The 3rd formula would error out if the list contains either text or numeric va
In this case the following would work irrespective of all kind of values
4

150

=INDEX(B:B,LOOKUP(9.999E+307,CHOOSE({1,2,3},MATCH("zzzzzzz",B:B)
99E+307,B:B),MAX(MATCH("zzzzzzz",B:B),MATCH(9.9999E+307,B:B)))))

CHOOSE returns array of values


1
2
3
4

#N/A =MATCH("zzzzzzz",B:B)
15 =MATCH(9.99999999999E+307,B:B)
#N/A =MAX(MATCH("zzzzzzz",C:C),MATCH(9.9999E+307,B:B))
15 =LOOKUP(9.9999E+307,CHOOSE({1,2,3},#N/A,15,#N/A))
Now LOOKUP returns the last numeric value, i.e 15.

ng of 255 "z"s is considered the largest string Excel can handle.

gest number that you can enter in Excel

CH("zzzzzzzzzz",C:C),MATCH(9.9999E+307,C:C)))

C) -> returns the position of last text value

C:C) -> returns the position of the last numeric value


get the maximum value

ue we used INDEX function.

error out if the list contains either text or numeric values only.
ng would work irrespective of all kind of values

9.999E+307,CHOOSE({1,2,3},MATCH("zzzzzzz",B:B),MATCH(9.99
ATCH("zzzzzzz",B:B),MATCH(9.9999E+307,B:B)))))

99999999999E+307,B:B)
CH("zzzzzzz",C:C),MATCH(9.9999E+307,B:B))

9.9999E+307,CHOOSE({1,2,3},#N/A,15,#N/A))

he last numeric value, i.e 15.

Name
Tom
Kris
Alan
Dan
Bob

Value
2700
2300
2000
2250
2100

Match Figure

2500
Tom

Break MIN(ABS(E1-B2:B6))
200
200
500
250
400

=MIN(ABS($E$1-B2))
=MIN(ABS($E$1-B3))
=MIN(ABS($E$1-B4))
=MIN(ABS($E$1-B5))
=MIN(ABS($E$1-B6))

200 =MIN(D9:D13)
Break ABS(E1-B2:B6)
200
200
500
250
400

=ABS($E$1-B2)
=ABS($E$1-B3)
=ABS($E$1-B4)
=ABS($E$1-B5)
=ABS($E$1-B6)

200 =MIN(D17:D21)

Now MATCH(MIN(ABS(E1-B2:B6)),ABS(E1-B2:B6),0)
1 =MATCH(200,{200,200,500,250,400},0)
Tom =INDEX(A2:A6,1)

Since we are looking for an exact match, MATCH returns the first name Tom though Tom and

name Tom though Tom and Kris got same values.

field 1
a30
a31
a32
a33
a34
a35
a36
a37
a38
a39

a100021
a100022
a100023
a100024
a100025
a100026
a100027
a100028
a100029
a100030

=VLOOKUP(INDEX(A2:A32,MATCH(1,SUBTOTAL(3,OFFSET(A2:A32,ROW(A2:A32)-ROW(A2),,
Table
a10
a20
a30
a40

=Sheet1!$D$39:$E$42

a
b
c
d

if we break OFFSET(A2:A32,ROW(A2:A32)-ROW(A2),,1) we would get the following

{"a10";"a11";"a12";"a13";"a14";"a15";"a16";"a17";"a18";"a19";"a20";"a21";"a22";"a23";"a24";"a25";"a2
9";"a30";"a31";"a32";"a33";"a34";"a35";"a36";"a37";"a38";"a39";"a40"}

now incorporating the above within SUBTOTAL(3,OFFSET(A2:A32,ROW(A2:A32)-ROW(A2),,1)), the resu

{0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;1;1;1;1;1;1;1;1;1;1;0}
now MATCH(1,{0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;1;1;1;1;1;1;1;1;1;1;0},0) yields 21
now INDEX(A2:A32,21) returns "a30"
VLOOKUP("a30",Table,2,0) returns c

2,ROW(A2:A32)-ROW(A2),,1)),0)),Table,2,0)

22";"a23";"a24";"a25";"a26";"a27";"a28";"a2

2)-ROW(A2),,1)), the result would be;

},0) yields 21

You can make custom message in a cell where you can define two conditions
if the condition for B10 is <100 "Not OK", >=100, "OK"

OK

102 OK

If you need the cell to show the value as well as the message;
see B13
Custom format the cell as
[<100]# "Not OK";[>=100]# "OK";General

SumThis
SumThis
CountThis
CountThis
CountThis
CountThis
SumThis
SumThis
CountThis
CountThis
SumThis
SumThis
SumThis
CountThis
CountThis
CountThis
SumThis
SumThis
CountThis
CountThis
SumThis
SumThis
CountThis
CountThis

10
20
30
40
50
60
70
80
90
100
110
120
130
140
150
160
170
180
190
200
210
220
230
240

990 =SUM(SUMIF(INDIRECT({"a2:a3","a12:a14","a18","a22:a23"}),"sumthis",INDIRECT({"b
10 =SUM(COUNTIF(INDIRECT({"a4:a7","a15:a17","a21","a24:a25"}),"countthis"))

22:a23"}),"sumthis",INDIRECT({"b2:b3","b12:b14","b18","b22:b23"})))
"a24:a25"}),"countthis"))

Name
McGrath
Brett Lee
Shane Warne
Stuart Clark
Gillespie
Symonds

Overs
10.0
9.4
10.0
8.0
7.0
5.2
50.0
=DOLLARFR(DOLLARDE(SUM(B4:B9),6),6)

if months recorded as ;
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec

0.01
0.02
0.03
0.04
0.05
0.06
0.07
0.08
0.09
0.10
0.11
0.12

adding 1 year
1.01
1.02
1.03
1.04
1.05
1.06
1.07
1.08
1.09
1.10
1.11
1.12

1.09 years
1.10 years
3.07 years
=DOLLARFR(DOLLARDE(SUM(E19:E20),12),12)

Budgeted
Cost Heads
Cost Head #1
Cost Head #2
Cost Head #3
Cost Head #4
Cost Head #5

Jan
4324
49586
25295
71438
97194

Feb
93473
6278
23022
16157
70894

Mar
23212
76559
24764
947
77817

Apr
95667
10698
30558
29634
66071

May
73473
86827
36055
65316
10949

Jun
2781
52489
23979
95415
57229

Jul
40805
23201
28623
536
71861

Aug
67103
82211
34349
85656
72385

Actual
Cost Heads
Cost Head #1
Cost Head #2
Cost Head #3
Cost Head #4
Cost Head #5

Jan
4824
49086
24545
71938
97944

Feb
93973
7028
22272
15657
71394

Mar
22712
75809
25264
447
78567

Apr
96417
10198
31058
28884
66571

May
72723
87327
36805
64816
10449

Jun

Jul

Aug

Current Month
Cost Heads
Cost
Cost
Cost
Cost
Cost

Head
Head
Head
Head
Head

#1
#2
#3
#4
#5

Nov
=TEXT(TODAY(),"mmm")
Budgted Actual
(YTD)
(YTD)
505564
290649
457822
229448
397222
139944
513116
181742
695645
324925
Formula in B19 and copied down
=SUM(B3:INDEX(B3:M3,MATCH($B$17,$B$2:$M$2,0)))
Formula in C19 and copied down
=SUM(B11:M11)

Sep
41301
16506
65236
52288
18220

Oct
42663
28215
13142
43155
67056

Nov
20762
25252
92199
52574
85969

Dec
28961
22218
9138
60144
31415

Sep

Oct

Nov

Dec

A
a
B
b
C
c
D
d
E
e
Aa
aA
Bb
bB

10
20
30
40
50
60
70
80
90
100
110
120
130
140

aA
Aa

120 =INDEX(B1:B14,MATCH(TRUE,EXACT(D2,A1:A14),0))
110 =INDEX(B1:B14,MATCH(TRUE,EXACT(D3,A1:A14),0))

EXACT(D2,A1:A14) evaluates;

{FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;TRU
MATCH(TRUE,EXACT(D2,A1:A14),0) yields 12
12 in array (A1:A14) for INDEX yields "aA"

SE;FALSE;FALSE;FALSE;TRUE;FALSE;FALSE}

A
B
D
F
C
E
F
C
F
D
A
Avg. Value
Avg. Char
Avg. Char

Averaging letters between A to F

3.73 =AVERAGE(INDEX(CODE(UPPER(B2:B12))-64,0,0))
D =CHAR(CEILING(AVERAGE(INDEX(CODE(UPPER(B2:B12))-64,0,0)),1)+64)
D =CHAR(CEILING(SUMPRODUCT(--(CODE(UPPER(B2:B12)))-64)/COUNTA(B2:B12),1)+64)

OUNTA(B2:B12),1)+64)

A
B
D
E
F
F
F
G
F
F
A
D
S
A
A
C
V
A
S
A
A
G
A
A

You might also like