عدد با قالب متن
به طور مثال کد 012 را به صورت 012` ( کلید پ زیر ESC ~ ) وارد کنید .
یا قبل از نوشتن عدد ،سلول را قابل بندی متن کنید:
FORMAT CELLS>NUMBER>TEXT
به طور مثال کد 012 را به صورت 012` ( کلید پ زیر ESC ~ ) وارد کنید .
یا قبل از نوشتن عدد ،سلول را قابل بندی متن کنید:
FORMAT CELLS>NUMBER>TEXT
۱- ابتدا سلول هایی را که می خواهید فرمول های درونشان دیده نشوند یا تغییر نکنند پس از انتخاب سلول مورد نظر، از منوی :
FORMAT>FORMAT CELLS> PROTECTION
گزینه های LOCKED , HIDEN راانتخاب می کنیم تا سلول قفل شود اما این قفل تا زمانی که کاربرگ قفل نشود فعال نمی گردد. برای قفل کردن کاربرگ باید آنرا سیو کرده و سپس از منوی
TOOLS>PROTECTION>PROTECT SHEET
را انتخاب نماییم تا کاربرگ با شروط ذکر شده قفل شود آنگاه سلول های قفل شده دیگر تغییر نخواهند کرد.
سلولهایی که گزینه HIDEN آنها فعال است، فرمول هایشان را در نوار فرمول نشان نمی دهند ( پس از قفل شدن کاربرگ )
فایل آموزشی اکسل مقدماتی را برای دانلود روی وبلاگ قرار دادم ؛ این فایل ویراستاری نشده و از تمام دوستانی که نظرات، انتقادات و پیشنهادات خود را یادداشت می کنند متشکرم.
دانلود جزوه مقدماتی آموزش اکسل
در کاربرگ در یافتی:
۱- مجموع دریافتی های علی چقدر است ؟
۲- مجموع دریافتی های هر فرد چقدر است؟
۳- مجموع دریافتی های هر فرد در هر ماه چقدر است؟ ( لیست حقوقی)
۴- میانگین دریافتی های هر فرد از هر بانک چقدر است ؟
در کاربرگ لوازم التحریر :
۱- هر فروشگاه از هر کالا چقدر فروخته ؟
۲- چه کلاهایی در چه شهرهایی بیشتر فروش داشته اند ؟
۲- جمع دریافتی های علی از بانک ملی چقدر است ؟
ترکیب فیلتر ها و تابع SUBTOTAL
Returns a subtotal in a list or database. It is generally easier to create a list with subtotals using the Subtotals command (Data menu). Once the subtotal list is created, you can modify it by editing the SUBTOTAL function.
Syntax
SUBTOTAL(function_num, ref1, ref2, ...)
Function_num is the number 1 to 11 (includes hidden values) or 101 to 111 (ignores hidden values) that specifies which function to use in calculating subtotals within a list.
Function_num (includes hidden values) |
Function_num (ignores hidden values) |
Function |
---|---|---|
1 | 101 | AVERAGE |
2 | 102 | COUNT |
3 | 103 | COUNTA |
4 | 104 | MAX |
5 | 105 | MIN |
6 | 106 | PRODUCT |
7 | 107 | STDEV |
8 | 108 | STDEVP |
9 | 109 | SUM |
10 | 110 | VAR |
11 | 111 | VARP |
Ref1, ref2, are 1 to 29 ranges or references for which you want the subtotal.
Remarks
Example
The example may be easier to understand if you copy it to a blank worksheet.
Selecting an example from Help
|
|
0=<نمره =<7 ضعیف
7<نمره =<14 متوسط
14<نمره =<20 خوب
پیام های مقابل آنها را چاپ نماید .
Sub NOMREH()
Dim NOM As Single
NOM = InputBox(" نمره را وارد کنید")
If NOM >= 0 And NOM <= 7 Then MsgBox "BAD"
If NOM > 7 And NOM <= 14 Then MsgBox " NOT BAD"
If NOM > 14 And NOM <= 20 Then MsgBox "GOOD"
End Sub
به این نکته توجه داشته باشید که اگر فرامین IF فقط یک دستور باشند دیگر نیازی به END IF نیست البته دستور مورد نظر را باید در پشت سر THEN نوشت .
*برگرفته از راهنمای اکسل*
Conditionally executes a group of statements, depending on the value of an expression.
Syntax
If condition Then [statements] [Else elsestatements]
Or, you can use the block form syntax:
If condition Then
[statements]
[ElseIf condition-n Then
[elseifstatements] ...
[Else
[elsestatements]]
End If
The If...Then...Else statement syntax has these parts:
Part | Description |
---|---|
condition | Required. One or more of the following two types of expressions: |
A numeric expression or string expression that evaluates to True or False. If condition is Null, condition is treated as False. | |
An expression of the form TypeOf objectname Is objecttype. The objectname is any object reference and objecttype is any valid object type. The expression is True if objectname is of the object type specified by objecttype; otherwise it is False. | |
statements | Optional in block form; required in single-line form that has no Else clause. One or more statements separated by colons; executed if condition is True. |
condition-n | Optional. Same as condition. |
elseifstatements | Optional. One or more statements executed if associated condition-n is True. |
elsestatements | Optional. One or more statements executed if no previous condition or condition-n expression is True. |
Remarks
You can use the single-line form (first syntax) for short, simple tests. However, the block form (second syntax) provides more structure and flexibility than the single-line form and is usually easier to read, maintain, and debug.
Note With the single-line form, it is possible to have multiple statements executed as the result of an If...Then decision. All statements must be on the same line and separated by colons, as in the following statement:
If A > 10 Then A = A + 1 : B = B + A : C = C + B
A block form If statement must be the first statement on a line. The Else, ElseIf, and End If parts of the statement can have only a line number or line label preceding them. The block If must end with an End If statement.
To determine whether or not a statement is a block If, examine what follows the Then keyword. If anything other than a comment appears after Then on the same line, the statement is treated as a single-line If statement.
The Else and ElseIf clauses are both optional. You can have as many ElseIf clauses as you want in a block If, but none can appear after an Else clause. Block If statements can be nested; that is, contained within one another.
When executing a block If (second syntax), condition is tested. If condition is True, the statements following Then are executed. If condition is False, each ElseIf condition (if any) is evaluated in turn. When a True condition is found, the statements immediately following the associated Then are executed. If none of the ElseIf conditions are True (or if there are no ElseIf clauses), the statements following Else are executed. After executing the statements following Then or Else, execution continues with the statement following End If.
Tip Select Case may be more useful when evaluating a single expression that has several possible actions. However, the TypeOf objectname Is objecttype clause can't be used with the Select Case statement.
Note TypeOf cannot be used with hard data types such as Long, Integer, and so forth other than Object.
IF یکی از پرکاربرد ترین دستورات VBA می باشد ، ساختار آن عبارت است از :
IF شرط THEN
عملیات مورد نظر
END IF
مثال : می خواهیم ساختار شرطی ایجاد کنیم که اگر محتویات سلول A1 از عدد 10 کوچکتر بود یک پیام مردودی نمایش دهد . ( فقط ساختار IF را نمایش می دهیم )
IF RANGE("A1")<10 THEN
MSGBOX" مردود"
END IF
SUB NAM()
DIM N AS STRING
DIM F AS STRING
N= INPUTBOX("ENTER NAME :")
F=INPUTBOX("ENTER FAMILY :")
MSGBOX N&" "&F
END SUB