Sunteți pe pagina 1din 6

What the if() - 6 different things you can do with excel if()

Created by http://chandoo.org/wp - Point Haired Dilbert - Feel free to share / extend / mail / save / modify

1. Sum Alternative Rows / Columns

# Data value
1 67 1 Alt. Row Sum 1: 640
2 77 0 Alt. Row Sum 2: 680
3 69 1
4 57 0
5 82 1
6 86 0
7 34 1
8 40 0
9 90 1
10 77 0
11 55 1
12 98 0
13 68 1
14 34 0
15 25 1
16 99 0
17 55 1
18 47 0
19 95 1
20 65 0

2. Count How Many Times Each Item on List A is Repeated in List B

List A List B

Cities # of Cust. Customer City


New York 2 Gill Bates Columbus
California 1 Beorge Gush Boston
Columbus 3 Yerry Jang Boston
Boston 3 Parry Lage New Delhi
New Delhi 1 Barren Wuffet New York
Mumbai 2 Amil Anbani Mumbai
Chicago 3 Tatan Rata Washington
Washington 1 Random Person Columbus
Another guy Columbus
Bridget Jones Boston
Pointy Haired Di Mumbai
Random Person California
Hollow Man Chicago
Another Girl Chicago
Cill Blinton Chicago
Random Person New York
3. Summarize Data with Countif and sumif

Summary
Avg. Sales per
City Total Cust. Total Sales Cust.
New York 2 $2,206 M $1,103 M
California 1 $38 M $38 M
Columbus 3 $4,047 M $1,349 M
Boston 3 $1,936 M $645 M
New Delhi 1 $1,950 M $1,950 M
Mumbai 2 $2,223 M $1,111 M
Chicago 3 $5,091 M $1,697 M
Washington 1 $1,207 M $1,207 M

4. Lookup 2nd / 3rd / 4th occurrence of an item in a list

Lookup Master Data


Customer Smith Customer CUST
Phone number Smith Smith1
1st 320-966-4023 Smith Smith2
2nd 686-612-7782 Jason Jason1
3rd 132-716-5240 Albert Albert1
4th 185-813-8883 Nancy Nancy1
Smith Smith3
Grove Grove1
Andy Andy1
Jason Jason2
Nancy Nancy2
Naancie Naancie1
Smith Smith4
Andy Andy2
Larry Larry1
Page Page1
Larry Larry2
Onemore Page Onemore Page1
Larry Larry3
Smith Smith5

5. Avoid nested if()s; Use choose() instead


Student Letter Grade Remarks
Ayan B Good
Barry B Good
Charles E Failed
Dan B Good
Emma D Poor
Fletcher D Poor
Gary C Acceptable
Harris C Acceptable
Indy A Excellent
Jones D Poor
Kamalini A Excellent
Larry B Good
Munroe D Poor

6. Your favorite if() hack…

Post your favorite hack in the comments section, show off to our readers what a data junkie you are…

http://chandoo.org/wp
do with excel if() functions
/ extend / mail / save / modify as you like

d in List B
Revenue Data per Customer

Customer City Sales


Gill Bates Columbus $918 M
Beorge Gush Boston $1,426 M
Yerry Jang Boston $235 M
Parry Lage New Delhi $1,950 M
Barren Wuffet New York $343 M
Amil Anbani Mumbai $1,893 M
Tatan Rata Washington $1,207 M
Random Person 1 Columbus $656 M
Another guy Columbus $2,474 M
Bridget Jones Boston $274 M
Pointy Haired Dilb Mumbai $330 M
Random Person 2 California $38 M
Hollow Man Chicago $1,904 M
Another Girl Chicago $624 M
Cill Blinton Chicago $2,563 M
Random Person 3 New York $1,863 M

ster Data
Phone number
320-966-4023
686-612-7782
122-617-7154
547-436-7376
956-633-7322
132-716-5240
340-267-0529
531-413-4718
613-228-4294
272-525-2042
474-163-1656
185-813-8883
591-797-3970
310-348-2518
131-551-5332
297-487-5253
431-384-0125
771-133-2877
304-024-4046
s what a data junkie you are…

S-ar putea să vă placă și