Geeks on Campus

Another amazing bgsu blog

Combine Multiple Rows and Fields

Posted by jeggent on June 28, 2018

TLDR;

Use LISTAGG(CONCAT(D.DESCR, CONCAT(‘ $’,C.OFFER_AMOUNT)), ‘ – ‘) WITHIN GROUP (ORDER BY B.EMPLID, C.PKG_SEQ_NBR)

To make this:

Student Term Award Amount
A. Person Fall 18 BG Scholarship 1000
A. Person Fall 18 Federal Grant 2000
A. Person Fall 18 Federal Loan 3500
B. Clever Fall 18 BG Scholarship 1000
B. Clever Fall 18 Outside Scholarship 2500

 

Look like this:

Student Term Awards
A. Person Fall 18 BG Scholarship $1000 – Federal Grant $2000 – Federal Loan $3500
B. Clever Fall 18 BG Scholarship $1000 – Outside Scholarship $2500

 

The Details

The LISTAGG function can be used in an expression to combine multiple rows of data.  The field(s) in the LISTAGG are grouped and then ordered by student.  A more simple version would be:

LISTAGG(D.DESCR,  ‘ – ‘) WITHIN GROUP (ORDER BY B.EMPLID)

This would give you a field with all of the awards separated by a space, dash, and space.  “Scholarship – Grant – Loan”

You can combine the LISTAGG function with the CONCAT function to combine multiple fields (Description and Amount) and/or fields and strings (Amount and “$”).

You can also specify multiple fields in the ORDER BY  to sort on more than one field. In the top example it is sorting by student and then within the student sorting the awards in the order they appear on the Assign Awards to a Student screen.

LISTAGG is (hopefully obviously) an aggregate function, so be sure to check the Aggregate Function checkbox on the “Edit Expression Properties” box and specify a length that will be enough to accommodate everything after combining.

I hope you find this useful. I think it’s really cool and makes for some much nicer looking output.

Posted in PeopleSoft, PS Query | No Comments »

Filters

Posted by jeggent on September 5, 2017

This is part of the Tuesday Excel Tips series.

Check out the listing of all the Tuesday Excel Tips.

A quick way to organize a data table in Excel is with Filters.  You can use filters to hide the rows of data that do not match the parameters you specify.  These parameters could be lists of values in one or multiple columns or greater-than less-than or ranges for number values.  You can also use filters for sorting.  To get started, select the column headers that you want included in the data table.  Click the Filter icon on the Home or Data menus.  Click the new icon next to the column header to see your options.  Once you have filtered a table you will see the icon change to a filter and the status bar at the bottom will show how many matches there were.  The example below shows “4 of 7 records found”.  You can re-select all of the items or click the filter clear icon to un-filter the list.

Filter

Posted in Excel | 1 Comment »

Removing Duplicates

Posted by jeggent on August 29, 2017

This is part of the Tuesday Excel Tips series.

Check out the listing of all the Tuesday Excel Tips.

You may at times have duplicate values depending on the level of detail in your data.  For example, if you have class enrollments listed, you will have multiple rows for each student within each term.  That is an obvious situation.  But there may be other times where it is not obvious that you would have duplication, such as a student having multiple careers in the same year.  Excel delivers ways to quickly identify duplicate values and eliminate them if needed.

Identify Duplicates

  1. Select a column or group of cells that you wish to identify duplicates among.
  2. Click the Conditional Formatting button on the Home tab.
  3. Select Highlight Cell Rules and click Duplicates Values…
  4. Choose the color you prefer in the box that pops up and click ok.

IdentifyDuplicates

Remove Duplicates

  1. Select column with duplicates values you want to be removed.
  2. Click Remove Duplicates from the Data tab.
  3. You get options to expand the selection and choose other columns or just remove values
    from the selected column. Hit ok when you’ve made your choice

RemoveDuplicates

Posted in Excel | 1 Comment »

Quick Formulas

Posted by jeggent on August 22, 2017

quickThis is part of Tuesday Excel Tips series.

You probably already know that the real power of Excel is in using formulas.  But you may not know that Excel comes with a few handy formulas already defined to make them easy for you to use.

If you select the cell below or to the right of a series of number, you can use the quick formula button to get the Sum, Average, Count, Max, or Min of the series.  If you just click the Sigma button it will Sum the numbers.  If you click the little down arrow you can select one of the other functions.

You can also do like the example below and select a data series and then use the quick formula.

Check out the listing of all the Tuesday Excel Tips.

 

QuickFormulas

Posted in Excel | 1 Comment »

Quick Info

Posted by jeggent on August 15, 2017

This is part of Tuesday Excel Tips series.

It’s fitting that I only have a small amount of time today to do this post.  Because this tip is all about getting information quickly.  If you highlight/select a group of cell in Excel it will give you some information about the data in those cell in the status area at the bottom of the window.  If the values are numeric Excel will show you the average, count, and sum of the values.  If the values are non-numeric then it will show you a count.  This is very hand if you just need to get one of those figures quickly and don’t need to keep the calculation on the sheet with the rest of the data.

Check out the listing of all the Tuesday Excel Tips.

quickinfo

Posted in Excel | 2 Comments »

Copy Down

Posted by jeggent on August 8, 2017

This is part of the Tuesday Excel Tips series.

If your spreadsheet needs some kind of list or series of labels such as a count, days of the week, days, months, etc. Excel can help you out with that.  As shown in the example below, a count is being entered into the first column.  We only need to enter the first couple of values so that Excel can determine that we increment the value by 1 each time.  Select those values and then place your mouse pointer on the box in the lower right corner of the selection.  Drag the cursor down to the last row you’d like filled and Excel will fill in the values for you.  If you already have data populated in the adjoining rows, you can just double-click that box and it will fill in the series down to your last row of data.  I think you will be pleasantly surprised how often Excel will figure out what values you’d like filled in.  This also works with formulas.  If in cell A1 you have the formula “=B1+C1” you can copy that down to the following rows and Excel will automatically update the references to B2+C2, B3+C3, and so on.

Check out the listing of all the Tuesday Excel Tips.

CopyDownSeries

Posted in Excel | 1 Comment »

Column Width

Posted by jeggent on August 1, 2017

This is part of the Tuesday Excel Tips series.

Adjusting Column Widths – When you first open Excel all of the columns are the same width.  If the entries in a column are longer than the column is wide you may want to adjust the column width to fit.  Or if you’re like me and have lots of columns, you may want to make some columns small to get more on the screen.

There are LOTS of ways to adjust the width of a column or a group of columns, here are some of them:

  1. Put your mouse pointer between the columns and drag the divider to the right or left.
  2. Double click the divider to automatically widen the column enough to fit your longest entry.
  3. Right click on a column header, choose column width, and specify a value.
  4. Click the upper left most corner (above 1 and left of A) to select the entire worksheet, then double click any column divider to adjust all columns to their longest entry.

Check out the listing of all the Tuesday Excel Tips.

AdjustColumnWidth

Posted in Excel | 1 Comment »

Format Painter

Posted by jeggent on July 25, 2017

This is part of the Tuesday Excel Tips series.

Format Painter allows you to apply the formatting of one cell to other cells.  You just select the cell that has the formatting, click on the Format Painter, then select the cells you want to format.  In the example below, cell A1 is bold and has a bottom boarder.  This formatting is applied to the other column titles using the Format Painter.

Check out the listing of all the Tuesday Excel Tips.

FormatPainter

Posted in Excel | 1 Comment »

Excel Tip Tuesdays

Posted by jeggent on July 25, 2017

Every Tuesday for the next couple of months I am going to post a tip to help you be more proficient with Excel.  You can bookmark this page as I will add links to each of the posts as they are published.

Here are the posts that have already been published and some future topics:FormatPainter

2017-07-25:  Using Format Painter
2017-08-01:  Adjusting Column Width
2017-08-08:  Copy Down Series/Formulas
2017-08-15:  Highlighting Cells for Quick Info
2017-08-22:  Quick Formulas
2017-08-29:  Identifying/Removing Duplicates
2017-09-05:  Filters

If you have any tips to share, I would love to hear them in the Comments section!

Cheers,

John

Posted in Excel | No Comments »

File Size

Posted by jeggent on February 19, 2016

This is just a public service announcement to save network traffic and file storage space.

When you run a query to Excel from PeopleSoft it will initially be in an Excel 2010 .xls file format.  The query results that I just download had 39,181 rows and 10 columns of data.  As an xls file it had a file size of 6,733 KB.  Without making any other changes I saved the file as an Excel 2013 .xlsx file and it reduced the file size to 1,756 KB.  That is almost 75% smaller.

Thank you for your attention.  You may now return to your memes and cat videos.

Posted in Excel, PeopleSoft, PS Query | 2 Comments »