Extracting only letters from text

If I need to extract only let­ters from my text, what should I do? Lets find out.

Extract only let­ters from text 

When I need to extract only let­ters from my text, it means that I also need to extract spaces and enters (new lines). 

With Pow­er Query this task is quite easy. 

I need to select one cell in my table, then go to the Data tab, and click on the From Table/Range com­mand in order to take our data to Pow­er Query (Fig. 1)

From Table/Range command
Fig. 1 From Table/Range command

Here, I have four sim­ple pieces of text. One in Eng­lish and three in Pol­ish. We need to go to the Add col­umn tab, then to the Cus­tom col­umn com­mand (Fig. 2)

Custom column command
Fig. 2 Cus­tom col­umn command

In the Cus­tom Col­umn win­dow, we have the space to name our col­umn. Let’s call it Clean, and below we have the Cus­tom col­umn for­mu­la box, where we write the Text.Select func­tion. In the func­tion we need to work with text, so let’s select the right col­umn (1). Then, I need let­ters. Since there will be string of char­ac­ters, I have to use curly brack­ets, where we write upper case let­ter in the first sequence, which is “A”..“Z”. Then let’s write low­er case let­ters, which is “a”..“z”. Writ­ing two dots between let­ters means that there is a sequence. Let’s close the curly brack­et and the paren­the­sis. Now, it should be fine (Fig 3)

Whole function
Fig. 3 Whole function

After press­ing OK, the sys­tem extract­ed for us only let­ters. How­ev­er, the text pre­sent­ed like this is just gib­ber­ish. That’s why we have to add spaces. To do that, we need to go to the View bar, then select the For­mu­la bar check­box and start mod­i­fy­ing our for­mu­la. Let’s write a com­ma and a space in dou­ble quotes (1). If we need oth­er signs, we should also write them, e.g. a dot (2). As we can see, we have spaces and dots in our new text (Fig. 4)

Modifying the formula
Fig. 4 Mod­i­fy­ing the formula

How­ev­er, I don’t need dots in my text. What I real­ly need are enters. We can remove the dot from the for­mu­la and write #(lf) in its place. After enter­ing the for­mu­la, we can see that we have extract­ed enters, low­er case let­ters, spaces. But, I did­n’t extract Pol­ish let­ters. In row 4 there are strict­ly Pol­ish let­ters. In rows 2 and 3 there are some of them. The ques­tion is: how can I extract unusu­al signs from text using the Text.Select func­tion. First of all, we have to check the Uni­code. We can see that let­ters from A to Z is a sequence of num­bers from 65 to 90. It’s sim­i­lar in low­er case let­ters. The most impor­tant les­son from it is that we have a sequence (Fig. 5) 

Unicode
Fig. 5 Unicode

Now, let’s go back to our for­mu­la. If I want to have Pol­ish let­ters, I can write a sequence of “Ó”..“ż”. After enter­ing the for­mu­la, we have extract­ed also Pol­ish signs (Fig. 6)

 Extracting Polish signs
Fig. 6 Extract­ing Pol­ish signs

Now, that we have extract­ed all signs we need, we can go to the Home tab and click on the Close&Load to com­mand to trans­fer our results to Excel (Fig. 7)

Loading results to Excel
Fig. 7 Load­ing results to Excel

In the Import Data win­dow, we have to select a cell (Fig. 7)

Choosing the target cell
Fig. 7 Choos­ing the tar­get cell

As we can see, the text is writ­ten in one line, so we need to wrap it. Let’s go to the Home tab and click on the Wrap Text com­mand (Fig. 8)

Wrap Text command
Fig. 8 Wrap Text command

Now, we clear­ly see upper case let­ter, low­er case let­ter, spaces, enters. I removed signs that I did­n’t need (Fig. 9)

Final table
Fig. 9 Final table

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

Hiding scroll bars, formula bars and column headers

When we need more space while work­ing in Dash­board in Excel, we can just hide unnec­es­sary options. How? Let’s find out.

Hide scroll bars, for­mu­la bars, col­umn headers

The options we can hide are e.g. scroll bars, sheet tabs, for­mu­la bars as well as column/row head­ers. If we want to hide then we just go to the File menu and choose the Options com­mand (Fig. 1)

Options
Fig. 1 Options 

In the Excel Options win­dow, we choose the Advanced tag. If you pre­fer using short­cuts, you can press Alt + T + O, which also opens the win­dow. Lets go to the Dis­play area and uncheck the Show for­mu­la bar check­box. Remem­ber that it works for all Excel files (Fig.2 )

Show formula bar checkbox
Fig. 2 Show for­mu­la bar checkbox

Then, we can go to the Dis­play options for this work­book area. We have to uncheck the Show hor­i­zon­tal scroll bar, Show ver­ti­cal scroll bar, Show sheet tabs check­box­es (Fig. 3)

Three checkboxes
Fig. 3 Three checkboxes

We can even go to the Dis­play options for this work­sheet area where we can uncheck the Show row and col­umn head­ers check­box and press OK (Fig. 4)

Show row and column headers checkbox
Fig. 4 Show row and col­umn head­ers checkbox

We can also dou­ble-click on the Home tab to hide the rib­bon, which gives us even more space than before. 

Now, I can press Ctrl + Page Down to go to anoth­er work­book. Here, we can see that col­umn and row head­ers are vis­i­ble. How­ev­er, when we go back to our work­book by press­ing Ctrl + Page Up, we can see that there are no row or col­umn head­ers. That’s how you make more space in your Dashboard. 

https://www.youtube.com/watch?v=2TNzX5RSG7A&t

Drop-down lists

How to add a drop-down list in Excel? It’s a real­ly sim­ple task. 

First of all, we have to have our list (1). Then, we have to select a cell or cells to which we want to add the drop-down list (2). Then, we’re going to the Data tab (3) and click on the Data Val­i­da­tion com­mand (4) (Fig. 1)

Preparing data
Fig. 1 Prepar­ing data

In the Data Val­i­da­tion win­dow, we have to select the List option in the Allow bar, then we’re select­ing the range and write it into the Source bar. Then OK (Fig. 3)

Data Validation window
Fig. 2 Data Val­i­da­tion window

Now, we have a drop-down list (Fig. 3)

A drop-down list
Fig. 3 A drop-down list

Since our cells with data are in a table, when we add a new line to the table, it also involves the drop-down list. 

Even, if we cut and paste our new data, the cells in the select­ed col­umn will still have the drop-down list. What’s more, in the newest Excel ver­sion, we have even Lookup options. We just have to start writ­ing the first let­ter of a word we’re look­ing for, then press the Tab key.

Lookup option
Fig. 4 Lookup option

This func­tion, how­ev­er, does­n’t work when we start from the mid­dle of our text. It works only with the first letter. 

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

KPI in Power Pivot Challenge 01

Today, we are going to address our first chal­lenge. The chal­lenge is to cre­ate KPI in the Pow­er Piv­ot bas­ing on an aver­age blood pres­sure. We want to cal­cu­late our aver­ages bas­ing on weeks, as it’s more com­pli­cat­ed that cal­cu­lat­ing month­ly averages :).

For indi­vid­u­als — deter­mine the aver­age month­ly ( for ambi­tious week­ly) upper blood pres­sure KPIs. We assume that if it is in the range of 110 — 130 it is Good, if it is in the range of 100 — 110 or 130 ‑140 it is OK, and if it is above or below these ranges, it is Bad. 

KPI in Pow­er Piv­ot | Chal­lenge 01

We have our Piv­ot with one cell select­ed. Let’s go to the Pow­er Piv­ot tab (1), then to the Add to Data Mod­el com­mand (2) (Fig. 1)

Add do Data Model command
Fig. 1 Add do Data Mod­el command

We can change here our date for­mat into the one with­out time (Fig. 2)

 Changing the Date format
Fig. 2 Chang­ing the Date format

Now, we have to cre­ate an aver­age bas­ing on the Upper blood pres­sure col­umn. We basi­cal­ly select one cell in the cal­cu­la­tion area (1), then go to the Home tab (2), then choose the Aver­age com­mand (3) (Fig. 3)

Average command
Fig. 3 Aver­age command

The Pow­er Piv­ot did the cal­cu­la­tion auto­mat­i­cal­ly for us. I’ll just change the name so that it’s short­er. Let’s leave only ‘pres­sure’. Now, let’s change the for­mat into Dec­i­mal Num­ber (Fig. 4)

 Decimal number command
Fig. 4 Dec­i­mal num­ber command

When we have the aver­age with two dec­i­mal places, we can start cre­at­ing a week col­umn, because it’s hard to group by weeks in the Pow­er Piv­ot. Let’s call this col­umn Week­Num. Then we can use exact­ly the same func­tion, which is the WEEKNUM func­tion bas­ing on the Date col­umn. If we want our week to start on Mon­day, we have to write 2 (Fig. 5)

=WEEKNUM([Date],2)

Creating a WeekNum column
Fig. 5 Cre­at­ing a Week­Num column

Let’s press Enter, and we have our col­umn with week num­bers. All weeks start from Mon­days. For some peo­ple this solu­tion would be enough. How­ev­er, I pre­fer to have the start day and the end day of the week. Let’s cre­ate anoth­er col­umn. This time I’ll call it week­Text. Let’s write ‘Date’. Then, we have to sub­tract the num­ber of the week­day. To do so, we can use the WEEKDAY func­tion again bas­ing on the Date col­umn. Now, we have three options of num­ber­ing the week­days. 1- Sunday=1 through Saturday=7, 2 — Monday=1 through Sunday=7, 3 — Monday=0 through Sunday=7. The last option is the one we need. Mon­day will be the first day, but it has got zero. It means that we will start count­ing from zero which is exact­ly what we need (Fig. 6)

=WEEKDAY([Date],3)

Creating a weekText column
Fig. 6 Cre­at­ing a week­Text column

After press­ing Enter, we have our new col­umn with only Mon­days. In all sev­en rows of the week we have only Mon­days. Now, let’s add the last day of the week. Let’s add a minus sign with spaces as a delim­iter. It allows us to delete the time from our col­umn. Then, let’s copy our WEEKDAY for­mu­la and paste it after the delim­iter. Then, we need to write +6 days to have Sun­day (Fig. 7)

First and last days of the week
Fig. 7 First and last days of the week

We can see the results. If the date for­mat is prop­er for us, this is all. But, if we want to change the date for­mat, we should add the FORMAT func­tion to the first and sec­ond cal­cu­la­tion (Fig. 8)

Adding the FORMAT function
Fig. 8 Adding the FORMAT function

How­ev­er, the cur­rent form is OK for me, so we can cre­ate a Piv­ot Table based on our mea­sures and cal­cu­la­tions. Let’s click on the Piv­ot Table com­mand in the Home tab (Fig. 9)

 Creating a pivot table
Fig. 9 Cre­at­ing a piv­ot table

Let’s select the New Work­sheet radio but­ton (Fig. 10)

Create PivotTable window
Fig. 10 Cre­ate Piv­ot­Table window

If I start with the Date col­umn and go to Rows, most new­er ver­sions will group data auto­mat­i­cal­ly by months. Let’s try to group it by days (Fig. 11)

Group option
Fig. 11 Group option

We can see that in the Pow­er Piv­ot the num­ber of days is grayed out and we can­not use it (Fig. 12)

Days grayed out
Fig. 12 Days grayed out

That’s why we should crate addi­tion­al columns to address this prob­lem. I should use the week­Num or the week­Text col­umn in our Rows area. Let’s also add Per­son to the Columns area and the Grand total by going to the Design tab and click­ing on the Grand Totals com­mand. Let also add our mea­sure, which is the fx pres­sure into Val­ues (Fig. 13)

Creating additional columns
Fig. 13 Cre­at­ing addi­tion­al columns

Now, we can see aver­age blood pres­sure for each per­son and each week. We also have the grand total for all peo­ple in a week. It’s time to add KPI to our piv­ot table. Let’s go to the Pow­er Piv­ot tab (1), then to the KPIs com­mand (2) and choose the New KPI option (3) (Fig. 14)

Creating KPI
Fig. 14 Cre­at­ing KPI

In the Key Per­for­mance Indi­ca­tor (KPI) win­dow, in the KPI base field val­ue, we have only pres­sure to choose from, so let’s leave it. In the Absolute Val­ue bar let’s write 120. In the Define Sta­tus Thresh­old graph­ics we should write our assump­tions, then select an icon style (Fig. 15)

Key Performance Indicator (KPI) window
Fig. 15 Key Per­for­mance Indi­ca­tor (KPI) window

Now, my mea­sures have changed into KPIs (Fig. 16)

KPIs
Fig. 16 KPIs

We still don’t see any icons. To switch them on, we need to uncheck the Sta­tus check­box and check it again (Fig. 17)

 Switching on icons
Fig. 17 Switch­ing on icons

Now, we can change the Pres­sure Sta­tus head­er name into KPI. We can also align the icons using the Cen­ter option in the Align­ment area (Fig. 18)

Center option
Fig. 18 Cen­ter option

We can see our aver­age week­ly mea­sure and KPIs cor­re­spond­ing to that mea­sure rep­re­sent­ed by icons. 

https://www.youtube.com/watch?v=lsyi8XEw2y0&t=3s

2D Lookup — INDEX and MATCH or XLOOKUP functions

How to do a 2D Lookup in Excel? Let’s start.

2D Lookup | Excel Tips 68

When we want to find an inter­sec­tion between a row and a col­umn bas­ing on head­ers, we can do it in two dif­fer­ent ways. The first one will be in Lega­cy Excel, and the sec­ond in Dynam­ic Array Excel.

The first solu­tion uses the MATCH func­tion as well as its close friend, the INDEX function. 

Let’s start with look­ing for the coun­try. In this case we want to find the row num­ber. Let’s write the cell, the range where we will be look­ing for and 0 for an exact match (Fig. 1)

=MATCH(B8,A3:A6,0)

MATCH function for countries
Fig. 1 MATCH func­tion for countries

We also want to find the col­umn num­ber. In this case we also use the MATCH func­tion. Let’s the cell, the range where we will be look­ing for and 0 for an exact match (Fig. 2)

=MATCH(B9,B2:G2,0)

MATCH function for months
Fig. 2 MATCH func­tion for months

When we have our row and col­umn num­bers, we can use the INDEX func­tion, select the whole dataset, then write the row and col­umn num­bers (Fig. 3)

=INDEX(B3:G6,D8,D9)

INDEX function
Fig. 3 INDEX function

Just like that, we did the 2D lookup, or we have found the val­ues we want­ed (Fig. 4)

Results
Fig. 4 Results

So far, we have had three for­mu­las. If we want to have only one, we need to imple­ment some mod­i­fi­ca­tions. We have to copy our MATCH func­tion and paste it in the place refer­ring to cell D8. Then, we have to copy the sec­ond MATCH func­tion with­out the equal sign, and paste it in the place of the ref­er­ence to cell D9. Now, we have one, big­ger for­mu­la instead of three small­er ones (Fig. 5)

=INDEX(B3:G6,MATCH(B8,A3:A6,0),MATCH(B9,B2:G2,0))

One, big formula
Fig. 5 One, big formula

Now, let’s focus on the solu­tion in the Array Excel. We will be using here the XLOOKUP func­tion twice. 

First, we are look­ing for a row in the coun­try head­ers. Then, as a return­ing array, we give Excel the whole dataset (Fig. 6)

=XLOOKUP(B8,A3:A6,B3:G6)

 XLOOKUP function
Fig. 6 XLOOKUP function

Since I’m using the XLOOKUP func­tion, and we are work­ing in the Array Excel, Excel will return the whole row. 

In such a case, we have to find a prop­er col­umn. We can also do it with the XLOOKUP func­tion. Let’s write the XLOOKUP func­tion once again. This time we will be look­ing for a month in the month head­ers. As a return array, we have the row we found pre­vi­ous­ly (Fig. 7)

=XLOOKUP(B9,B2:G2,XLOOKUP(B8,A3:A6,B3:G6))

Another XLOOKUP function
Fig. 7 Anoth­er XLOOKUP function 

And just like that, we have our results (Fig. 8)

Results
Fig. 8 Results

Even if we change the val­ues in our for­mu­la, the result is still cor­rect (Fig. 9)

Checking the formula
Fig. 9 Check­ing the formula

The results are cor­rect both in XLOOKUPs and INDEX with MATCH functions. 

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