Excel Formulas

PURNA CHANDRA RA
NDRA RAO P
Text 1    10    Text 1
 Text 2    20    Text 2       To get the LAST text value in a list
 Text 3    30    Text 3
 Text 4    40    Text 4   1   Text 15       =LOOKUP(REPT("z",255),A:A)
 Text 5    50    Text 5
 Text 6    60        60       Use of REPT function
 Text 7    70        70       REPT("z",255) -> A string consisting of 255 "z"s is considered the largest strin
 Text 8    80        80
 Text 9    90        90       To get the LAST numeric value in a list
Text 10   100      100
Text 11   110   Text 11   2          150 =LOOKUP(9.99999999999E+307,B:B)
Text 12   120   Text 12
Text 13   130   Text 13       9.9999999999999e+307 is the largest number that you can enter in Excel
Text 14   140   Text 14
Text 15   150   Text 15       To get the LAST value in a list

                              If a list contains both alpha and numeric values

                          3   Text 15       =INDEX(C:C,MAX(MATCH("zzzzzzzzzz",C:C),MATCH(9.9999E+307,C

                                            MATCH("zzzzzzzzzz",C:C) -> returns the position of last text value

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

                                            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 nu
                                            In this case the following would work irrespective of all kind of valu

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


                                            CHOOSE returns array of values

                                        1           15 =MATCH("zzzzzzz",B:B)
                                        2           15 =MATCH(9.99999999999E+307,B:B)
                                        3           15 =MAX(MATCH("zzzzzzz",C:C),MATCH(9.9999E+307,B:B

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

                                            Now LOOKUP returns the last numeric value, i.e 15.
5 "z"s is considered the largest string Excel can handle.




mber that you can enter in Excel




 zzzzzz",C:C),MATCH(9.9999E+307,C:C)))

 urns the position of last text value

 eturns the position of the last numeric value

maximum value

 ed INDEX function.


 t if the list contains either text or numeric values only.
  work irrespective of all kind of values

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




 9999E+307,B:B)
 zz",C:C),MATCH(9.9999E+307,B:B))

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

 umeric value, i.e 15.
Name   Value          Match Figure     2500
Tom            2700                  Err:504
Kris           2300
Alan           2000
Dan            2250
Bob            2100
                        Break MIN(ABS(E1-B2:B6))

                              200 =MIN(ABS($E$1-B2))
                              200 =MIN(ABS($E$1-B3))
                              500 =MIN(ABS($E$1-B4))
                              250 =MIN(ABS($E$1-B5))
                              400 =MIN(ABS($E$1-B6))

                              200 =MIN(D9:D13)

                        Break ABS(E1-B2:B6)

                              200 =ABS($E$1-B2)
                              200 =ABS($E$1-B3)
                              500 =ABS($E$1-B4)
                              250 =ABS($E$1-B5)
                              400 =ABS($E$1-B6)

                              200 =MIN(D17:D21)


                        Now MATCH(MIN(ABS(E1-B2:B6)),ABS(E1-B2:B6),0)

                           Err:504 =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       a100021
a31       a100022
a32       a100023
a33       a100024
a34       a100025
a35       a100026
a36       a100027
a37       a100028
a38       a100029
a39       a100030



                       Err:504 =VLOOKUP(INDEX(A2:A32,MATCH(1,SUBTOTAL(3,OFFSET(A2:A32,ROW(A2:A32)-ROW(A2),,

                                                               Table      =Sheet1!$D$39:$E$42
                              a10        a
                              a20        b
                              a30        c
                              a40        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
                    29";"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)




a22";"a23";"a24";"a25";"a26";"a27";"a28";"a


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




0},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      10
SumThis      20   30 =SUM(SUMIF(INDIRECT({"a2:a3","a12:a14","a18","a22:a23"}),"sumthis",INDIRECT({"b
CountThis    30    4 =SUM(COUNTIF(INDIRECT({"a4:a7","a15:a17","a21","a24:a25"}),"countthis"))
CountThis    40
CountThis    50
CountThis    60
SumThis      70
SumThis      80
CountThis    90
CountThis   100
SumThis     110
SumThis     120
SumThis     130
CountThis   140
CountThis   150
CountThis   160
SumThis     170
SumThis     180
CountThis   190
CountThis   200
SumThis     210
SumThis     220
CountThis   230
CountThis   240
22:a23"}),"sumthis",INDIRECT({"b2:b3","b12:b14","b18","b22:b23"})))
 "a24:a25"}),"countthis"))
Name            Overs
McGrath              10.0
Brett Lee             9.4
Shane Warne          10.0
Stuart Clark          8.0
Gillespie             7.0
Symonds               5.2
                     50.0

                =DOLLARFR(DOLLARDE(SUM(B4:B9),6),6)


if months recorded as ;
                             adding 1 year
Jan                   0.01         1.01
Feb                   0.02         1.02
Mar                   0.03         1.03           1.09 years
Apr                   0.04         1.04           1.10 years
May                   0.05         1.05           3.07 years
Jun                   0.06         1.06
Jul                   0.07         1.07      =DOLLARFR(DOLLARDE(SUM(E19:E20),12),12)
Aug                   0.08         1.08
Sep                   0.09         1.09
Oct                   0.10         1.10
Nov                   0.11         1.11
Dec                   0.12         1.12
Budgeted
Cost Heads            Jan       Feb       Mar      Apr    May      Jun     Jul    Aug
Cost Head #1         4324     93473     23212    95667   73473    2781   40805   67103
Cost Head #2        49586      6278     76559    10698   86827   52489   23201   82211
Cost Head #3        25295     23022     24764    30558   36055   23979   28623   34349
Cost Head #4        71438     16157       947    29634   65316   95415     536   85656
Cost Head #5        97194     70894     77817    66071   10949   57229   71861   72385

Actual
Cost Heads            Jan       Feb       Mar      Apr    May     Jun      Jul    Aug
Cost Head #1         4824     93973     22712    96417   72723
Cost Head #2        49086      7028     75809    10198   87327
Cost Head #3        24545     22272     25264    31058   36805
Cost Head #4        71938     15657       447    28884   64816
Cost Head #5        97944     71394     78567    66571   10449

Current Month  Sep     =TEXT(TODAY(),"mmm")
             Budgted Actual
 Cost Heads
              (YTD)     (YTD)
Cost Head #1   Err:508   290649
Cost Head #2   Err:508   229448
Cost Head #3   Err:508   139944
Cost Head #4   Err:508   181742
Cost Head #5   Err:508   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     Oct    Nov      Dec
41301   42663   20762   28961
16506   28215   25252   22218
65236   13142   92199    9138
52288   43155   52574   60144
18220   67056   85969   31415


 Sep     Oct     Nov     Dec
A     10
a     20   aA      Err:504 =INDEX(B1:B14,MATCH(TRUE,EXACT(D2,A1:A14),0))
B     30   Aa      Err:504 =INDEX(B1:B14,MATCH(TRUE,EXACT(D3,A1:A14),0))
b     40
C     50
c     60        EXACT(D2,A1:A14) evaluates;
D     70
d     80        {FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;TRU
E     90
e    100        MATCH(TRUE,EXACT(D2,A1:A14),0) yields 12
Aa   110
aA   120        12 in array (A1:A14) for INDEX yields "aA"
Bb   130
bB   140
SE;FALSE;FALSE;FALSE;TRUE;FALSE;FALSE}
A
     B
     D
     F              Averaging letters between A to F
     C
     E
     F
     C
     F
     D
     A
Avg. Value #VALUE! =AVERAGE(INDEX(CODE(UPPER(B2:B12))-64,0,0))
Avg. Char   #VALUE! =CHAR(CEILING(AVERAGE(INDEX(CODE(UPPER(B2:B12))-64,0,0)),1)+64)
Avg. Char         D =CHAR(CEILING(SUMPRODUCT(--(CODE(UPPER(B2:B12)))-64)/COUNTA(B2:B12),1)+64)
COUNTA(B2:B12),1)+64)
A   A
B
D
E
F
F
F
G
F
F
A
D
S
A
A
C
V
A
S
A
A
G
A
A

Huge Collection Of Formulae

  • 1.
  • 2.
  • 3.
    Text 1 10 Text 1 Text 2 20 Text 2 To get the LAST text value in a list Text 3 30 Text 3 Text 4 40 Text 4 1 Text 15 =LOOKUP(REPT("z",255),A:A) Text 5 50 Text 5 Text 6 60 60 Use of REPT function Text 7 70 70 REPT("z",255) -> A string consisting of 255 "z"s is considered the largest strin Text 8 80 80 Text 9 90 90 To get the LAST numeric value in a list Text 10 100 100 Text 11 110 Text 11 2 150 =LOOKUP(9.99999999999E+307,B:B) Text 12 120 Text 12 Text 13 130 Text 13 9.9999999999999e+307 is the largest number that you can enter in Excel Text 14 140 Text 14 Text 15 150 Text 15 To get the LAST value in a list If a list contains both alpha and numeric values 3 Text 15 =INDEX(C:C,MAX(MATCH("zzzzzzzzzz",C:C),MATCH(9.9999E+307,C MATCH("zzzzzzzzzz",C:C) -> returns the position of last text value MATCH(9.9999E+307,C:C) -> returns the position of the last nume 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 nu In this case the following would work irrespective of all kind of valu =INDEX(B:B,LOOKUP(9.999E+307,CHOOSE({1,2,3},MATCH("zzzzz 4 Err:502 99E+307,B:B),MAX(MATCH("zzzzzzz",B:B),MATCH(9.9999E+307,B: CHOOSE returns array of values 1 15 =MATCH("zzzzzzz",B:B) 2 15 =MATCH(9.99999999999E+307,B:B) 3 15 =MAX(MATCH("zzzzzzz",C:C),MATCH(9.9999E+307,B:B 4 #N/A =LOOKUP(9.9999E+307,CHOOSE({1,2,3},#N/A,15,#N/ Now LOOKUP returns the last numeric value, i.e 15.
  • 4.
    5 "z"s isconsidered the largest string Excel can handle. mber that you can enter in Excel zzzzzz",C:C),MATCH(9.9999E+307,C:C))) urns the position of last text value eturns the position of the last numeric value maximum value ed INDEX function. t if the list contains either text or numeric values only. work irrespective of all kind of values 307,CHOOSE({1,2,3},MATCH("zzzzzzz",B:B),MATCH(9.99 zzzzz",B:B),MATCH(9.9999E+307,B:B))))) 9999E+307,B:B) zz",C:C),MATCH(9.9999E+307,B:B)) 307,CHOOSE({1,2,3},#N/A,15,#N/A)) umeric value, i.e 15.
  • 5.
    Name Value Match Figure 2500 Tom 2700 Err:504 Kris 2300 Alan 2000 Dan 2250 Bob 2100 Break MIN(ABS(E1-B2:B6)) 200 =MIN(ABS($E$1-B2)) 200 =MIN(ABS($E$1-B3)) 500 =MIN(ABS($E$1-B4)) 250 =MIN(ABS($E$1-B5)) 400 =MIN(ABS($E$1-B6)) 200 =MIN(D9:D13) Break ABS(E1-B2:B6) 200 =ABS($E$1-B2) 200 =ABS($E$1-B3) 500 =ABS($E$1-B4) 250 =ABS($E$1-B5) 400 =ABS($E$1-B6) 200 =MIN(D17:D21) Now MATCH(MIN(ABS(E1-B2:B6)),ABS(E1-B2:B6),0) Err:504 =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
  • 6.
    name Tom thoughTom and Kris got same values.
  • 7.
    field 1 a30 a100021 a31 a100022 a32 a100023 a33 a100024 a34 a100025 a35 a100026 a36 a100027 a37 a100028 a38 a100029 a39 a100030 Err:504 =VLOOKUP(INDEX(A2:A32,MATCH(1,SUBTOTAL(3,OFFSET(A2:A32,ROW(A2:A32)-ROW(A2),, Table =Sheet1!$D$39:$E$42 a10 a a20 b a30 c a40 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 29";"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
  • 8.
  • 9.
    You can makecustom 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
  • 11.
    SumThis 10 SumThis 20 30 =SUM(SUMIF(INDIRECT({"a2:a3","a12:a14","a18","a22:a23"}),"sumthis",INDIRECT({"b CountThis 30 4 =SUM(COUNTIF(INDIRECT({"a4:a7","a15:a17","a21","a24:a25"}),"countthis")) CountThis 40 CountThis 50 CountThis 60 SumThis 70 SumThis 80 CountThis 90 CountThis 100 SumThis 110 SumThis 120 SumThis 130 CountThis 140 CountThis 150 CountThis 160 SumThis 170 SumThis 180 CountThis 190 CountThis 200 SumThis 210 SumThis 220 CountThis 230 CountThis 240
  • 12.
  • 13.
    Name Overs McGrath 10.0 Brett Lee 9.4 Shane Warne 10.0 Stuart Clark 8.0 Gillespie 7.0 Symonds 5.2 50.0 =DOLLARFR(DOLLARDE(SUM(B4:B9),6),6) if months recorded as ; adding 1 year Jan 0.01 1.01 Feb 0.02 1.02 Mar 0.03 1.03 1.09 years Apr 0.04 1.04 1.10 years May 0.05 1.05 3.07 years Jun 0.06 1.06 Jul 0.07 1.07 =DOLLARFR(DOLLARDE(SUM(E19:E20),12),12) Aug 0.08 1.08 Sep 0.09 1.09 Oct 0.10 1.10 Nov 0.11 1.11 Dec 0.12 1.12
  • 14.
    Budgeted Cost Heads Jan Feb Mar Apr May Jun Jul Aug Cost Head #1 4324 93473 23212 95667 73473 2781 40805 67103 Cost Head #2 49586 6278 76559 10698 86827 52489 23201 82211 Cost Head #3 25295 23022 24764 30558 36055 23979 28623 34349 Cost Head #4 71438 16157 947 29634 65316 95415 536 85656 Cost Head #5 97194 70894 77817 66071 10949 57229 71861 72385 Actual Cost Heads Jan Feb Mar Apr May Jun Jul Aug Cost Head #1 4824 93973 22712 96417 72723 Cost Head #2 49086 7028 75809 10198 87327 Cost Head #3 24545 22272 25264 31058 36805 Cost Head #4 71938 15657 447 28884 64816 Cost Head #5 97944 71394 78567 66571 10449 Current Month Sep =TEXT(TODAY(),"mmm") Budgted Actual Cost Heads (YTD) (YTD) Cost Head #1 Err:508 290649 Cost Head #2 Err:508 229448 Cost Head #3 Err:508 139944 Cost Head #4 Err:508 181742 Cost Head #5 Err:508 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)
  • 15.
    Sep Oct Nov Dec 41301 42663 20762 28961 16506 28215 25252 22218 65236 13142 92199 9138 52288 43155 52574 60144 18220 67056 85969 31415 Sep Oct Nov Dec
  • 16.
    A 10 a 20 aA Err:504 =INDEX(B1:B14,MATCH(TRUE,EXACT(D2,A1:A14),0)) B 30 Aa Err:504 =INDEX(B1:B14,MATCH(TRUE,EXACT(D3,A1:A14),0)) b 40 C 50 c 60 EXACT(D2,A1:A14) evaluates; D 70 d 80 {FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;TRU E 90 e 100 MATCH(TRUE,EXACT(D2,A1:A14),0) yields 12 Aa 110 aA 120 12 in array (A1:A14) for INDEX yields "aA" Bb 130 bB 140
  • 17.
  • 18.
    A B D F Averaging letters between A to F C E F C F D A Avg. Value #VALUE! =AVERAGE(INDEX(CODE(UPPER(B2:B12))-64,0,0)) Avg. Char #VALUE! =CHAR(CEILING(AVERAGE(INDEX(CODE(UPPER(B2:B12))-64,0,0)),1)+64) Avg. Char D =CHAR(CEILING(SUMPRODUCT(--(CODE(UPPER(B2:B12)))-64)/COUNTA(B2:B12),1)+64)
  • 19.
  • 20.
    A A B D E F F F G F F A D S A A C V A S A A G A A