# 4.3 Using If-Then-Else Structure Part 2

Video Activity

Join over 3 million cybersecurity professionals advancing their career

Sign up with

or

Already have an account? Sign In »

Video Transcription

00:01

okay, in this worksheet, we're having simple transformation

00:06

off just size to us size of shirt.

00:10

So let's, uh let's go and look at the macro that we

00:16

have made for this occasion.

00:19

And here it this. So we're now first at the beginnings saying that

00:26

number is active Cell Well, you so active cell is the cell. That is

00:32

we were selecting now at the

00:35

the

00:36

the sheet

00:38

and we're saying just for the sake off less typing.

00:43

Um,

00:45

it's

00:46

number is this So

00:50

then we start with if structure and we say if number is less and equal of 34 which is

00:57

the measurement for

00:59

X s

01:00

opera, Well, you

01:03

then

01:04

range

01:06

be three. Well, you is going to be string called X s containing access

01:12

else, So it's not

01:15

less or equal to 34 so it's higher.

01:19

Then we check if it's less or equal than 36.

01:25

And if it is, then it goes into category of size s

01:29

and so on. For 38 we go into category of em for less than 40. It's l. If it's less than 42 it's excel. And if it's less than 44 it's double x l

01:45

And if none of that is the case,

01:51

we get the message Books just size out of range. Check big and tall sizes. So this is these are standard sizes. We have the bigger now because we have six ifs. You see, we said if then else and then we started with next if

02:07

then else if then else, anything else

02:10

we had six.

02:13

Let's say levels off. If,

02:16

um,

02:17

we have to close it with six end ifs

02:21

Now what we can do

02:23

is

02:27

shift these

02:30

one level

02:36

so that

02:38

we can visually

02:46

separate them.

02:50

So we have one space here extra

02:54

and then we can

02:58

put. And if so, it closes.

03:00

It's appropriate level.

03:04

And this way

03:07

we can

03:12

visually

03:14

see

03:16

that we have closed everything.

03:19

So this and if is at the same

03:23

level as if

03:25

and

03:28

now it's easier to

03:30

see how many of them we need.

03:32

We're closing the sub and sub.

03:36

We can save this now

03:39

and

03:42

let's just check

03:45

what is

03:46

shortcut.

03:49

It's control shift s

03:53

so

03:55

we

03:57

see.

03:58

Let's just size is 41.5

04:02

and we quicken. You have to select this cell control shift. This

04:09

and it gets Excel

04:12

or 21.4. Sorry.

04:14

And if we would put here 49

04:17

and click on control shift

04:21

this.

04:23

We get just size out the French trick. Begin toll sizes

04:30

and that's it. Now you see here we got the leftover XXL from the last one, so we have to correct this macro.

04:40

So let's go to shirt size

04:42

at it. And at the beginning,

04:46

let's put

04:47

range

04:53

B three

04:56

Don't. Well, you

05:00

equals

05:01

just this

05:03

so that we make sure the beginning that the well, who is

05:08

not there.

05:11

So if something is left from the previous calculation, it will be arranged. Arranged a racist story.

05:18

So let's close this.

05:21

And let's, uh,

05:24

pris now again, Control, shift this

05:28

and it raises the previous result, and we get the correct message here. So this is how dysfunction works.

05:39

This

05:40

my crew

Up Next

Intermediate Excel

Being an intermediate level user of Excel can help save a user hours of work time and take full advantage of the Excel application. Taking an intermediate Excel training will help students advance their skills and pass an intermediate Excel exam.

Instructed By

Similar Content