Professional Documents
Culture Documents
too [spreadcheats]
Posted on November 12th, 2008 in Learn Excel - 78 comments
If for every countif() I write excel paid me a dollar, I would be a millionaire by now. It is such a
versatile and fun formula to work with that I have decided to write about it as third post in
our spreadcheats series.
1.
2.
Counting Valid Phone Numbers in a Range: Using operators < and > in countif() you can
findout valid phone numbers in range like this: countif("data-range",">"&1000000000)
3.
Finding number of customers in a city based on their phone number: This trick may
not work perfectly. We can use countif("data-range","22*") to findout total customers in
Mumbai (since all Mumbai phone numbers begin with 22)
Note: This method works as long as phone numbers have identifiable calling codes and stored as
text. To covert a number to text you can use text() or append an empty space to the number.
4.
Pattern matching: Often when you extract data from other sources and paste it in excel it is
difficult to process it when the formats are not consistent. For eg. when you copy address data of a
bunch of customers and need to know how many customers are in New York you can use countif
like this: countif("data range", "*new york*"), the operator * tells excel to match any cell with
new york in it, not necessarily at the beginning or end of the cell.
5.
Counting positive numbers in a range: Again we use the > operator to count the positive
numbers in a range like this: countif("data-range",">0").
A very good use of this trick is when you need to calculate average of a bunch of numbers but need
to exclude zeros: sum("data-range")/countif("data-range","<>0")
6.
7.
For sorting text: Read more on this at sorting text using excel formulas
8.
Do you need a simple POS (point of sale) system for your small retail shop? With this
method, you can manage the following facilities without special software or expensive
equipment:
Manage purchases
Control inventory
Daily sales
Daily purchases
Steps
1. 1
Learn Microsoft Excel. Learn about Excel macros.
o
Create Excel workbook with 6 worksheets for followings steps like this:
Bills
Pur
Purchase
Sales
Stock balance
Setup
2
Create a setup page with these headings, setup your stock items
o
Category Code : Create specific codes for your each item. This must be a unique
ID number for each items. Use this to create the barcodes.
According to this, take all the inventory items & create a code and update the
sheet with opening stock, pur, price, and sales price. You have to give the correct purchase price
and sales prices because when you issue a bill, price will be selected from this sheet. The
opening balance will be linked with the stock balance sheet. If you dont have a barcode printer,
just print the receipt to A4 Sheet and paste it to your sales items.
Code: =IF(setup!$B$3:$B$323<>"",setup!$B$3:$B$323,"")
Description: =IF(setup!$C$3:$C$323<>"",setup!$C$3:$C$323,"")
Purchase: =SUM(IF(B3=purchase!$B$2:$B$2005,purchase!$D$2:$D$2005))
Sales: =SUM(IF(B3=sales!$H$2:$H$2551,sales!$J$2:$J$2551))
Stock: =+D3+E3-F3
3
Create a bill sheet:
o
Create a sheet according to this format and give the below formula to each row
and create macros with below codes.
Line: =IF(C5="","",B4+1)
Code: Create a list box link with setup page item code and name. when you
connect a bar code reader with bar code sticker details will auto pick.
o
Description: =I4
Qty : this column you have to enter manually according to customer purchase qty.
Price: =IF(E4="","",VLOOKUP(C4,al,5,0)*E4)
Create a button called Save bill and copy this code: You can download
this file form file
Sub Dayendsales()'
'Dayendsales Macro
Sheets("Tsales").Select
Columns("G:G").Select
Range("E2:E255").Select
Selection.copy
Range("G2").Select
Sheets("sales").Select
Range("B3:D1572").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("D3").Select
End Sub
Sub DayendPurchases()'
Sheets("Tpurchase").Select
Columns("F:F").Select
Range("D2:D643").Select
Selection.copy
Range("F2").Select
SkipBlanks _
=False, Transpose:=False
Application.CutCopyMode = False
Sheets("purchase").Select
Range("C3:D625").Select
Selection.ClearContents
Range("E3").Select
End Sub
Sub SaveBill()'
End Sub
Sub DayEnd()'
End Sub
4
Create a Pur sheet: according to this format
Now create the Purchase and sales data save page with this format:
Ads by Google
COUNT
The COUNT function counts the number of cells in a range that have
numbers in them. If you use a formula to run a lot of calculations,
you may find yourself wondering how many times it workedCOUNT
can help here. If a formula returns an error (like #DIV/0!) for some
entries, you can easily find out how many times that happened.
COUNT only counts a cell if it contains a number, a date, a logical
value, or a text representation of a number. If you want to include
cells that have text, error values, and empty text, use the COUNTA
function. To do the opposite, use COUNTBLANK.
The [range] argument defines the range of cells that you want to do
your counting in. In the spreadsheet below (data created randomly
with www.generatedata.com), we have columns for first name, last
name, city, state, and SAT score. Some of the SAT scores are
missing, and were going to find out how many. We know that there
are 100 people in the spreadsheet, so well use COUNT on the SAT
score column with the following syntax:
=COUNT(E:E)
As you can see, 85 students have values in the SAT score column, so
were missing scores from 15 students.
COUNTIF
This function is very similar to COUNT, but lets you set the criteria
for which cells get counted. Heres the syntax:
=COUNTIF([range], [value])
You could use this method for counting the number of students who
scored above a certain number, for example, by using >1500 as
your argument. You can also use a cell as a counting reference. Well
do that here to see how many students live in Texas. Well use the
following syntax:
=COUNTIF(D:D, D2)
The cell D2 contains Texas, and we can use the cell reference
instead of typing out the name of the state.
COUNTIFS
Whereas COUNTIF lets you count based on a single criterion,
COUNTIFS lets you use as many criteria as youd like. You can also
use it to count based on multiple criteria in multiple ranges. Heres
the syntax:
=COUNITFS([criteria_range1], [criteria1], [criteria_range2],
[criteria2])
Well use this to see how many students from Hawaii scored over
1500 on their SAT. Heres the syntax well use:
=COUNTIFS(D:D, Hawaii, E:E, >1500)
When we run that, this is what we get:
SUMIF
You probably know how to use SUM to add up a series of numbers
(like Brad used in creating his Excel dashboard), but what if you only
want to add up a portion of those numbers? SUMIF lets you choose
which cells are added by specifying a criterion. Heres the syntax:
=SUMIF([range], [criteria], [sum_range])
SUMIFS
If you want to use multiple criteria to select which cells to add you
can use SUMIFS. The syntax is a bit different than SUMIF:
=SUMIFS([sum_range], [criteria_range1], [criteria1],
[criteria_range2], [criteria2])
functions that you can use if youre working with arrays or databases,
but those will have to wait for another time.
And if youre looking for something a little more out of the ordinary,
check out these7 fun and weird things you can create in Excel.