Spy Journal 3.0 - MOD
https://www.spyjournal.biz/taxonomy/term/309/0
enExcel Function of the Week - MOD
https://www.spyjournal.biz/excel-function-week-mod
<p>The MOD function is very useful in certain circumstances.</p>
<p>The function returns the integer remainder after a number has been divided by a divisor. For example if you divide 10 by 3, it goes in 3 times with one remaining.</p>
<p><a href="http://www.spyjournal.biz/files/image_83.png"><img title="image" height="274" alt="image" src="http://www.spyjournal.biz/files/image_thumb_86.png" width="594" border="0" /></a></p>
<p>I have used this function numerous times when I am looking for values that have a decimal value in a list of data. For example If I have 20,000 rows of data that has been sucked from an accounting system and is supposed to be whole values, and when I sum them I get a value that has decimal places I know that one or more of the numbers has decimal places. Sometimes you get a number that looks like this 58.0000001 or 47.999999992 and if the column of data is showing values with no decimal places these are rounded up or down accordingly for the view in the cell. Adding a column beside the data and putting a formula like=MOD(A1,1) and then copying it to the bottom of the range will give me a list of zeros. Any values that have a decimal place (Eg are not a whole number and do not divide evenly by 1) will display the remainder. Filtering the dataset by this column where it does not equal zero will find these values for you.</p>
<p>Of course MOD has many other uses than this. It can be used to find the whole number remainders from any number.</p>
<p>If you have a unique way of using MOD feel free to comment and let me know.</p>
https://www.spyjournal.biz/excel-function-week-mod#commentsExcelMODhttps://www.spyjournal.biz/crss/node/951Mon, 03 Nov 2008 08:45:51 +0000jethro951 at https://www.spyjournal.bizDeveloping in Excel 2007
https://www.spyjournal.biz/developing-excel-2007
<p>I much prefer working in Excel 2007 to Excel 2003. Despite the issues with <a href="/exceltips/2007/04/excel-2007-and-backward-compatibility.html">backward compatibility</a>, there are a lot of advantages and benefits to using the new version.</p>
<p>Some little things that have been changed are</p>
<p>The previous limit on nested brackets in formulas from 7 has been increased to 64. I used this today</p>
<p>The number of columns and rows has increased. I used this today.</p>
<p>I had to develop a file for a client that involved a complex work roster arrangement to calculate days off in repeating 2, 3 or 4 week cycles for the next 20 years.</p>
<p>Here is the nested formula that got me the logic for a roster.</p>
<p>=IF($X5>=AJ$4,$X$4,IF($Y5>=AJ$4,$Y$4,IF($Z5>=AJ$4,$Z$4,IF($AA5>=AJ$4,$AA$4,IF($AB5>=AJ$4,$AB$4, IF($AC5>=AJ$4,$AC$4,IF($AD5>=AJ$4,$AD$4,IF($AE5>=AJ$4,$AE$4,IF($AF5>=AJ$4,$AF$4,$AG$4)))))))))</p>
<p>I then used one formula to generate over 600,000 cells and create a map that looks like this.</p>
<p>=INDEX(data,MATCH(C$1,codes,0),(IF(MOD($A3,VLOOKUP(C$1,Rules!$AH:$AI,2,FALSE))=0,VLOOKUP (C$1,Rules!$AH:$AI,2,FALSE),MOD($A3,VLOOKUP(C$1,Rules!$AH:$AI,2,FALSE))))+2)</p>
<p>I used the VLOOKUP formulas because this was a quick and dirty application, not one that needed to stand the test of time. Also the speed of the calculation wasn’t an issue on my <a href="/node/392">development machine</a>. I would have built more robust formulas if this application was going to see regular use.</p>
<p><a href="http://www.spyjournal.biz/files/image_80.png"><img title="image" height="381" alt="image" src="http://www.spyjournal.biz/files/image_thumb_83.png" width="594" border="0" /></a> </p>
<p><a href="http://www.spyjournal.biz/files/image_79.png"><img title="image" height="129" alt="image" src="http://www.spyjournal.biz/files/image_thumb_82.png" width="244" align="right" border="0" /></a>From here I needed to generate a list of the “weekend” periods from their start date to end date.</p>
<p>It needed to look like the table to the right as this was going to be uploaded into their enterprise system.</p>
<p>Given the large number of cells this had the potential to go below the 65535 rows allowed in Excel 2003.</p>
<p>In the end I only used 58471 rows so was comfortably inside the limit. However if they add more rosters this could break.</p>
<p>I cannot display the code here as it is the intellectual property of the client – as they have paid for it.</p>
<p>The result for the client is huge. Entering 230,000 odd pieces of data into a system manually would have been very tedious.</p>
<p>Generating the 90 odd rosters manually and then uploading them would still have been very tedious and needed to be repeated if there were any problems or errors or new rosters.</p>
<p>This application including the initial consulting, logic development and code writing (there’s only 57 lines including all commenting)  took a little over 2 days. You do the math on how much it saved! The code runs in about 15 seconds on my system. Probably a little more on a less grunty PC. This is the power of Excel and VBA automating repetitive tasks and what we make a lot of money doing!</p>
https://www.spyjournal.biz/developing-excel-2007#commentsExcelIFINDEXMATCHMODVLOOKUPhttps://www.spyjournal.biz/crss/node/932Wed, 15 Oct 2008 02:00:24 +0000jethro932 at https://www.spyjournal.biz