Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Advanced formula editing

As a former excel user I have a quite advanced formula that’s recogniced by numbers when importing the workbook. Can anyone assist, or provide a new one?


Excel formula:

=-INDIRECT(CONCATENATE(LEFT(ADDRESS(MATCH(1E+307;$B$24:$B$258);2);3);RIGHT(ADDRE SS(MATCH(1E+307;$B$24:$B$258);2);2)+23))+INDIRECT(CONCATENATE(LEFT(ADDRESS(MATCH (1E+307;$B$24:$B$258);2);3);RIGHT(ADDRESS(MATCH(1E+307;$B$24:$B$258);2);2)+22))


This formula is based on a single Colum, initially takes the value in the last cell with content and subtracts is from the second last within the same Colum.

In addition, if the value is negative the color changes to red, and similar if positive, changes to green.

iMac (27-inch Mid 2010), OS X El Capitan (10.11.1)

Posted on Nov 26, 2015 12:56 AM

Reply
11 replies

Nov 26, 2015 2:41 AM in response to Kimao2

Hi Kimao2,


I haven't taken a close look at your formula, but this may get you started.

User uploaded file

The second table is a duplicate of the first. The checkbox cell is used as a trigger to force a recalculation of the values in column B. (This works in Numbers 2, but Numbers 3 has a more refined recalc behaviour, and won't do a full recalculation on the click of a checkbox that no other cell on the table depends on.)


The numbers in column B are based on the position of each cell in the column, with a random component included to make a drop in value from one row to the next possible.


Here is the formula that compares the last two values in the column. Note that it does require that every non-header cell above the last two also contains a numerical value.


C1: =OFFSET(B$1,COUNT(B),0)-OFFSET(B$1,COUNT(B)-1,0)


A conditional format (conditional highlighting in Numbers 3) rule is set to change the fill colour of C1 to red when the formula result in less than zero.


Regards,

Barry

Nov 26, 2015 7:50 AM in response to Kimao2

There are a few problems with that formula.


From what I can tell, LEFT(ADDRESS(MATCH(1E+307;$B$24:$B$258);2);3) will always give you the string $B$ if it finds any number in the column. It is unnecessarily complex when you could replace all that with "$B$".


The MATCH function works differently in Excel and Numbers. It is supposed to find the largest value equal to or less than the number you are searching for. But in Excel, MATCH requires the list to be sorted numerically ascending to work properly. In Excel, when you search for a really large number in a randomly sorted list of numbers (or numbers and non-numerics), what it really does is find last numeric value in the column. In Numbers it returns the largest value equal to or less than the value being searched for, just like it is supposed to do.


You did not mention what your column of data looks like. It makes a difference in the answer. Does it include only numbers (as Barry assumed, though COUNT will also include dates) or is it a mix of numbers and non-numerics? Are there any blank rows (Barry assumed there were not)? Do the numbers appear in ascending or descending order or are they in no particular order?


I do not think there is a one-column formula for locating the last value in a column that may have blank rows interspersed within the data unless the numbers are are in ascending or descending order. I do not know if there is a one-column formula for finding the lowest appearing number in a column of numbers and non-numeric values unless the numbers are in ascending or descending order.

Nov 26, 2015 10:41 AM in response to Kimao2

IF, as Badunit suggests, you do NOT have blank cells interspersed in your data, you can do something like this if you want to subtract the last number from the penultimate number.

User uploaded file

=INDEX(B,COUNTA(B)−1)-INDEX(B,COUNTA(B))


This does not require sorting.


Also, I generated the example numbers in column B with =RANDBETWEEN(1,5) in cells B1:B7. In Numbers 3.6.1 RANDBETWEEN() recalculates automatically whenever the checkbox in A1 is checked (or any other change is made to the table).


The last three rows in my example are defined as Footer Rows.


SG

Nov 27, 2015 12:07 AM in response to Badunit

Badunit wrote:

"I do not think there is a one-column formula for locating the last value in a column that may have blank rows interspersed within the data unless the numbers are are in ascending or descending order. I do not know if there is a one-column formula for finding the lowest appearing number in a column of numbers and non-numeric values unless the numbers are in ascending or descending order."


My thoughts as well.

This would be possible using an auxiliary column to index the entries, and a lookup function to retrieve the last two entries in the data column.


User uploaded file

The blue Warning triangle in cell D1 warns that the formula references/includes cells not containing numeric values. Numbers can be instructed to ignore the warning, or it may be avoided by replacing the null string ( "" ) with zero ( 0 ) in the formula creating the index values in column C. Column C may be hidden, so including strings of zeroes in rows where the data column (B) is empty would not affect the visual display of the table.


Formulas:

C2: =IF(LEN(B)<1,"",ROW())

Alternate:

C2: =IF(LEN(B)<1,0,ROW())

Fill this formula down to the end of column C.


D1: =LOOKUP(LARGE(C,2),C,B)-LOOKUP(LARGE(C,1),C,B)


Regards,

Barry

Nov 27, 2015 12:31 AM in response to Kimao2

All,


First off, thanks for all the input, most appreciated!


I’ve added a picture which explains the formulas simple function – simple but still complicated to fulfill.

The formula in Excel was created with good support from colleagues, so this is a bit over my knowledge levels.


It may be worth mentioning that the solution preferable should work on both Mac and iOS, as the entire reason for this is the cloud drive sync.


Please feel free to comment and advise in how to achieve this in the simplest way 🙂


User uploaded file

Nov 27, 2015 1:44 AM in response to Kimao2

Hi Kimao2,


Given that the values in column B are numbers, that there are no empty cells above the last two values in that column, and that the table may be laid out to contain only one row above the list of values:


Either of the formulas suggested my post and that of SGIII will do the job quite effectively.


Place the data on a table separate from the one used for summarizing and reporting the results.

Define row 1 of the data table as a Header row.

Assign two conditional Format/conditional highlight rules to the cell containing the Improvement value:

less than 0 set text colour to red

greater than 0 set text colour to green

(a value of exactly 0 will result in text keeping the default colour—probably black)


Regards,

Barry

Nov 27, 2015 7:46 AM in response to Kimao2

Assuming your table name is still 'Runs' as in the template, you can do this:


User uploaded file


=INDEX(Runs::B,COUNTA(Runs::B))−INDEX(Runs::B,COUNTA(Runs::B)+1)


Change the , to ; if needed for your Region.

Change to table name as needed.


The Conditional Highlighting that worked for for me was this (after first selecting Duration):


User uploaded file


SG

Advanced formula editing

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.