How to create a star rating in Excel

When we want to cre­ate a star rat­ing in Excel, there is at least one pos­si­ble solution.

How to cre­ate a star rat­ing in Excel in 3 minutes

We want to use stars from the Unichars, Uni­code. We just need to use the UNICHAR func­tion and a prop­er uni­code (Fig. 1).

Fig. 1 UNICHAR function

In old­er ver­sions of Excel, copy­ing those stars from the Inter­net should also work. We just have to have the signs we want to repeat. As we can see, we already have num­ber rat­ing. The biggest num­ber is five, and the low­est is zero and there is a prop­er num­ber of stars next to them. Let’s delete them how­ev­er, and start cre­at­ing a prop­er for­mu­la from the begin­ning. We start with the REPT func­tion. We write G4 because our text string is there, then press the F4 key to lock it. When we want to add the num­ber of times we want to repeat, we write C2, which is in the Rat­ing col­umn. Then, we close the for­mu­la (Fig. 2).

=REPT($G$4,C2)

Fig. 2 REPT function

We can copy it down and we have our black stars (Fig. 3). 

Fig. 3 Start rating

How­ev­er, we assumed that we always want to have five stars. It means that if the rat­ing is low­er than five, we have to add some white stars. In such a case, we just have to com­bine one REPT func­tion with anoth­er REPT func­tion using an amper­sand. In the sec­ond REPT func­tion, we have to write G5 and press the F4 key to lock it. In the place on the num­ber of repeats, we have to write five minus C2 - a cell from the Rat­ing column. 

=REPT($G$4,C2) &REPT($G$5,5-C2)

Fig. 4 Two REPT func­tions com­bined with an ampersand 

When we tell the REPT func­tion to repeat zero times, it won’t repeat any­thing, i.e. it will return an emp­ty text string. In the case of a 5‑star rat­ing, we have five stars. How­ev­er, then it comes to a cell with zero, the REPT func­tion treats it the same as an emp­ty cell in most sit­u­a­tions (Fig. 5).

Fig. 5 Star rat­ing results

https://www.youtube.com/watch?v=Apu9OMrSxHA

Data bars in a cell using character repeat

Today, we are going to talk about cre­at­ing charts like data bars in cells using for­mu­las. We want to cre­ate some­thing like this (Fig. 1)

Data bars in a cell using char­ac­ter repeat
Charts from data bars
Fig. 1 Charts from data bars

Let’s start with cre­at­ing a prop­er for­mu­la. We have to use the REPT (repeat) func­tion. It will repeat a text, one or more chars, as many times as we write in the sec­ond argu­ment. Let’s start with a pipe (a ver­ti­cal line). We want to repeat it as many times as there are sun­ny days in a giv­en month. Our for­mu­la looks like this (Fig. 2). 

=REPT(“|”,B2)

REPT formula with a pipe
Fig. 2 REPT for­mu­la with a pipe

After enter­ing and copy­ing down, we have data bars. How­ev­er, the dis­tance between indi­vid­ual signs is too big (Fig. 3) 

Data bars with too long distances
Fig. 3 Data bars with too long distances

We have to nar­row it by using, e.g. a dif­fer­ent font that works with this sign. We are select­ing our data bars and chang­ing the font name to Script (Fig. 4). Now, it looks much better. 

Font change
Fig. 4 Font change

Let’s try, how­ev­er, a dif­fer­ent font. With Bri­tan­ni­ca Bolt, the signs look like real data bars (Fig. 5). 

Font change again
Fig. 5 Font change again

Let’s take the last exam­ple, which is the Haet­ten­schweil­er font. In my opin­ion, it looks the best, so I’m stay­ing with this one (Fig. 6)

The best font
Fig. 6 The best font

Apart from repeat­ing a pipe, we can repeat oth­er signs. If they are wider than the pipe and if the num­ber of repeats is too big, we may have a prob­lem (Fig. 7)

=REPT(“*”,B2)

A formula with an asterisk
Fig. 7 A for­mu­la with an asterisk

We can see, that the aster­isk string is too long (Fig. 8)

Too long
Fig. 8 Too long

The solu­tion is divid­ing the num­ber, and the REPT func­tion will only look at the inte­ger part of the num­ber. Let’s divide our num­bers safe­ly by two (Fig. 9). 

=REPT(“*”,B2/2)

Number division
Fig. 9 Num­ber division

When there is a small­er num­ber of repeats, it looks quite good (Fig. 10) 

Shorter strings
Fig. 10 Short­er strings

We have to remem­ber that an aster­isk is a sim­ple sign, and we can use what­ev­er sign we like. Let’s take, for exam­ple, a star (Fig. 11) 

=REPT(“★”,B2/2)

A formula with a star
Fig. 11 A for­mu­la with a star

We can see that the strings are very long (Fig. 12). We can divide them by even a greater num­ber, e.g. 3. 

=REPT(“★”,B2/3)

Dividing by 3
Fig. 12 Divid­ing by 3

After putting the for­mu­la, it looks good (Fig. 13). 

Shorter strings
Fig. 13 Short­er strings

In our last exam­ple, we are going to repeat the let­ter n (Fig. 14)

=REPT(“n”,B2/3)

Repeating n
Fig. 14 Repeat­ing n

Now, we can see many ns (Fig. 15) 

N string
Fig. 15 N string

How­ev­er, we can change our font into Wind­ings, and the let­ter n changes into squares, which looks quite good as data bars (Fig. 16)

N into squares
Fig. 16 N into squares

Sum­ming, up, when we use dif­fer­ent signs and dif­fer­ent num­ber of repeats, we can cre­ate quite good data bars using a formula. 

https://www.youtube.com/watch?v=XYs6Eu-0hZw

Extract First Last and Middle Name with Formulas 

Today, we are going to talk about extract­ing first names, mid­dle names and last names from full names. We define the first name as the first word from the left, the last name as the first word from the right, and the mid­dle name, as every­thing between those two. Mid­dle names are a bit com­pli­cat­ed, as they can may con­sist of one word, a space, an abbre­vi­a­tion, or two or more words (Fig. 1)

Extract First Last and Mid­dle Name with Formulas
A list of names
Fig. 1 A list of names

Let’s start with extract­ing the first name. We just have to use the LEFT func­tion, which extracts signs from the left. We have to insert the FIND func­tion there, so that it finds the first space, and write the space in dou­ble quotes (Fig. 2)

=LEFT(A2,FIND(“ “,A2))

Extracting the first name
Fig. 2 Extract­ing the first name

Now, we have the first name (Fig. 3).

The first name
Fig. 3 The first name

But, we have to remem­ber that the FIND func­tion will return the posi­tion of the sign we’re look­ing for, which means that it finds the 7th posi­tion, which is a space (Fig. 4). 

7th position
Fig. 4 7th position

The first name , how­ev­er, con­sists of only 6 let­ters, which is what we want. It means that we want to extract less let­ters. So, we have write the for­mu­la once again, but this time we sub­tract one sign (Fig. 5)

=LEFT(A2,FIND(“ “,A2)-1)

Subtracting one sign
Fig. 5 Sub­tract­ing one sign

Now, we have only the first name with­out unnec­es­sary signs. After drag­ging it down, the whole col­umn is full (Fig. 6)

Full column
Fig. 6 Full column

Let’s go to last names. This case is a bit more com­pli­cat­ed. We don’t know whether we’re look­ing for the first, the sec­ond, the third or even a more dis­tant space (Fig. 7) 

Too many possible spaces
Fig. 7 Too many pos­si­ble spaces

There’s a trick to solve it. We have to repeat spaces. With­in our text, we have to sub­sti­tute a sin­gle space into many spaces, let’s say 29. We use the REPT func­tion (Fig. 8)

=SUBSTITUTE(A2,” “,REPT(“ “,29))

Repeating spaces
Fig. 8 Repeat­ing spaces

After accept­ing our func­tion, we have our changed names with many spaces between them (Fig. 9)

Names with many spaces
Fig. 9 Names with many spaces

Now, we can start extract­ing names from the right side. We’re extract­ing not only all signs from our name, but also the remain­ing 29 signs (Fig. 10).

=RIGHT(SUBSTITUTE(A2,” “,REPT(“ “,29)),29)

Extracting name and 29 signs
Fig. 10 Extract­ing name and 29 signs

Now, we have the last name and many, many spaces before it (Fig. 11)

Name with spaces
Fig. 11 Name with spaces

We have to delete them using the TRIM func­tion. The TRIM func­tion removes all spaces from a text string except for a sin­gle space between words. So, each space at the begin­ning and at the end of the string will be removed (Fig. 12)

=TRIM(RIGHT(SUBSTITUTE(A2,” “,REPT(“ “,29)),29))

Trimming unnecessary spaces
Fig. 12 Trim­ming unnec­es­sary spaces

After accept­ing it and copy­ing it down, we have our last names (Fig. 13). 

Last names
Fig. 13 Last names

Now, we have to find the thing between the first and the last name. We will use the SUBSTITUTE func­tion. In the place of the first name, we will place noth­ing, i.e. an emp­ty text string (Fig. 14). 

=SUBSTITUTE(A2,B2,“”)

Finding the middle name
Fig. 14 Find­ing the mid­dle name

Now, we have a short­er ver­sion of our name (Fig. 15).

Shorter version
Fig. 15 Short­er version

Let’s remove the last name now. We want to sub­sti­tute the last name with an emp­ty text string (Fig. 16)

=SUBSTITUTE(SUBSTITUTE(A2,B2,“”),D2,“”)

Removing the last name
Fig. 16 Remov­ing the last name

After enter­ing and copy­ing down, we have every­thing between the first name and the last name (Fig. 17). As you can see, we have also extract­ed spaces which we don’t need. So, let’s use the TRIM func­tion to delete unnec­es­sary spaces.

=TRIM(SUBSTITUTE(SUBSTITUTE(A2,B2,“”),D2,“”))

Unneeded spaces
Fig. 17 Unneed­ed spaces

Because we are edit­ing whole col­umn we can press Ctrl + Enter.

That’s how we extract first names, last names and every­thing in between with appro­pri­ate formulas. 

Final results
Fig. 18 Final results

https://www.youtube.com/watch?v=v46vQGjwx0w