Formula confused by sorting

I feel that I may have missed the right page in a manual with this problem.
I have a table recently imported from XL (with no initial problems). The table has some 3,000 rows and 12 columns. It is a listing of geographic locations, map No. grid reference, and location category and data related to each location. The related data is updated frequently.
Working with the list requires frequent filtering and sorting (filtered and unfiltered) all of which works fine. Several of the columns require either countif or counta calculations involving all 3000 rows. This also works fine until the rows (selected to avoid header rows and calculation results at the base) are re-sorted. After sorting based on one or two columns the simple formula: Countif(C5:C2943,"Yes") becomes something like: Countif(C345:C496,C5:C125,C1234:C2341) . . .etc. That is, the single array becomes seriously fractured such that it does not produce a numerical result. This occurs whether the cell references in the formula are relative or absolute. How can I prevent this happening and still use what appears to be a quite basic function?
Q2. Is there a way to permanently define a contiguous range of rows for sorting without having to manually select it before each sort?
Many thanks.

Thank you for your reply (and for the unnecessary rapp over my knuckles). I have been searching for several days. The reply you directed me too was seriously over-complicated for what I was wrestling with.
Instead I have found a very simple answer. All it required was a simple new table to contain the formula, strategically placed to appear correctly in the printed reports. I am very new to Numbers so still addressing the logic/layout differences to XL which I have been using for many years.

Similar Messages

  • Table with a column with RANK formula does not sort properly

    Hello,
    I have a table in excel with Rank function that reference another column with numerical values. The results in the column (called Rank) with rank function are as expected but Sorting (ascending or descending) doesn't
    work as expected on the column .  The Rank gets sorted in the following order: 1,15, 2,19, 8 , 4......
    Few things that I've verified are:
    1. Verified that there are no text values in the column.
    2. Tried changing the format to number but this still doesn't resolve the sort issue.
    3. Copied the values from the Rank column to a different sheet and applying sort works as expected.
    Does anyone have any idea on what could be wrong? Appreciate your help!
    Thanks!

    Resolved the issue. I had an incorrect formula in one of the that was referenced by the Rank column.

  • FUNCTION/FORMULA to randomly sort, then select from rows

    Hi! Using Numbers more now but still quite new. VERY used to Apple way and familiar with Automator, at least capable of copy/pasting an Applescript, and somewhat versed in UNIX. Basically need to shuffle all the entries in say "Column A" and maybe "B", and then pick from them and 'print' to a file or some other field or table. At the very least even being able to just make the couple thousand names being entered in to their-own field randomly-sorted would be a BIG help. Just in case I'm not being clear, instead of just sorting ascending or descending. Thank you!!!
    Message was edited by: jon215

    Hi jon,
    Numbers will only sort in ascending or descending order, and sorts whole rows (not individual columns) on the basis of the contents of one or more columns. It will sort the entire table (excepting any header and footer rows), or will sort selected rows.
    If you want to do a random sort of a column of names, you can do it by adding a column, entering this formula into all cells in the column (except header and footer cells), and sorting on the new column.
    =RAND()
    The formula generates a random number between 0 and 1. When the table is sorted, the sort will place those numbers in ascending or descending order (as you choose), but will then immediately calculate a new set of random numbers.
    If you just need to pick a random name form the list, you can use OFFSET and RANDBETWEEN.
    If the names are in column A, starting at A2, this formula, placed elsewhere on the same table, will return a random name from the list:
    =OFFSET($A$1,RANDBETWEEN(1,ROWS($A)-1),0)
    Regards,
    Barry

  • Formula Confusion

    Dear all,
    I have created a formula which counts number of working days. This formula then has been modified to subtract Bank holidays.
    When I use a array formula of bank holidays dates, it works fine however when I use a holidays table within a database for bank holidays it doesn;t seem to work.
    For example:
    Using Holidays Array Formula
    BeforeReadingRecords;
    DateVar Array Holidays := [
    Date (2003,12,25),   // you can put in as many lines for holidays as you want. 
    Date (2003,12,31),
    Date (2008,08,25)
    0
    Using Subreport>Formula->Shared Datevar with my main report
    whileprintingrecords;
    Shared DateVar Array Holidays;
    numbervar i := i + 1;
    numbervar j := count({bank_hol.holiday_date});
    if i <= j then (
    redim preserve Holidays[j+1];
    Holidays<i> := {bank_hol.holiday_date}
    The 2nd formula when used in the report, does not account for bank holidays. I don't know where I am doing wrong
    Here is the main formula for Working days. (To use it with 2nd formula above, just change the Datevar Holidays to Shared Datevar Holidays;
    Working Day Formula
    WhileReadingRecords; //Change this to Whileprintingrecords when using it with subreport.
    Local DateVar Start := Date(Year(CurrentDate),Month(CurrentDate),1);
    Local DateVar End :=   Currentdate;
    Local NumberVar Weeks;
    Local NumberVar Days;
    Local Numbervar Hol;
    DateVar Array Holidays; //Change this to Shared DateVar Holidays when using subreport formula
    Weeks:= (Truncate (End - dayofWeek(End) + 1 - (Start - dayofWeek(Start) + 1)) /7 ) * 5;
    Days := DayOfWeek(End) - DayOfWeek(Start) + 1 +
    (if DayOfWeek(Start) = 1 then -1 else 0)  +
    (if DayOfWeek(End) = 7 then -1 else 0); 
    Local NumberVar i;
    For i := 1 to Count (Holidays)
    do (if DayOfWeek ( Holidays<i> ) in 2 to 6 and
    Holidays<i> in start to end then
    Hol:=Hol+1 );
    Weeks + Days - Hol;
    Any help will be appreciated.
    Many thanks
    Regards
    Jehanzeb

    Vitaly,
    I was going to reply to you but suddenly some how your post vanished.
    Anyhow,
    The Subreport is placed on the report header, I have checked my dates with my database dates by inputting a formula in my sub report. They both are identical.
    Which means that my sub report is producing right results.
    The formula (workingdays) is solely used to get averages of my jobs and lenses.
    The report Selection Record formula is
    ({lab_rework.rework_date} in monthtodate and
    {lab_reasons.reason_code} >= {?startcode} and
    {lab_reasons.reason_code} <= {?endcode});
    So the Jobs and Lenses are printed in accordance with Month to date.
    The question arises when I use Holiday Array formula within my report using manual entries into an array and link it with Working days formula, it works however, when I do the same with Shared Datevar array with my subreport it does not want to work.
    here is the formula which I inserted into the sub report to test my dates in accordance with Database dates.
    whileprintingrecords;
    shared datevar array Holidays;
    numbervar i := i + 1;
    numbervar j := count({bank_hol.holiday_date});
    if i <= j then (
    redim preserve Holidays[j+1];
    Holidays<i> := {bank_hol.holiday_date}
    This very formula is shared with my main report via
    Shared DateVar Array Holidays;
    Regards
    Jehanzeb

  • The formula field is not sorting both ascending and descending

    Dear All,
                   I am designing scoreboard the net amount contains the formula field, i sorted with asceding order by using sort,but it is not sorted both ascending or descending ,
                  Suppose if i used to sort the database field it is sorted properly  so any one help me very urgent
    Regards
    Selva.D
    Edited by: Rui Pereira on Aug 8, 2008 11:32 AM

    Dear Suda,
                     The scoreboard i designed via query print layout. So i calculated  by using formula field ie totalsales- sales return for that i used formula and i follow the below steps
    Choose repetitive area -
    > Right mouse click---> sort
    in the sorting i choose the formula uinque id and i choose Ascending then summary, after i click ok
    Suggest me the solution
    Regards
    Selva.D
    Edited by: Rui Pereira on Jul 8, 2008 5:18 PM

  • Sort descending a column generated by a simple formula?

    I have just upgraded to Numbers 3.2 from '09 and I have discovered this nasty problem where I can not “sort descending” a column generated by a simple formula.
    Imagine the sequence 1, 2, 4, 8, 16, 32, 64…
    — Let's add the first number, “1” in B1
    — Click on B2 and make it equal to B1*2
    — And so on, click your B2 cell and drop to bottom.
    We get this nice succession:
    OK. Now imagine we want to “sort-descending” this. We press on top and choose the descending option. And then we get this annoying result:
    How I can to fix this problem?
    This worked perfectly on previous Numbers versions ('09) and of course in Excel or OpenOffice. And it's a very “simple” and common feature.
    Or maybe I'm forgetting or misunderstanding something?
    Thanks for your support :-)
    Cristóbal Vila.

    Sorting has changed since the previous version.
    You can sort this by selecting the column with the sequence, then copy
    then select the menu item "Edit > Paste Formula Results"
    now sort
    another way is to place a "count" in column A... 0 thru whatever
    and place a formula to computer the power of two from that count:
    In this case I entered 0 in cell A1, then 1 in cell A2
    select cells A1 and A2 and fill down as needed by dragging the yellow dot that appears when you hover the cursor over to bottom edge of the selection
    In cell B1 I entered the formula "=2^A1"
    no select cell B1 copy
    select column B,  paste
    now you have a sort-safe table and may sort as needed

  • How to populate the parameter selection with a formula

    Post Author: jhartney
    CA Forum: Formula
    Confused or maybe just way to much coffee but I need some help here.
    I want to create a dynamic multiple select parameter field pulled from the database.  The fields in the DB are FIRSTNAME and LASTNAME and I want to concat those to look like "LASTNAME, FIRSTNAME" and populate the parameter list.  The selection from that list will later be passed to the record selection to match in a different database table/field FULLNAME.
    JON

    Post Author: jhartney
    CA Forum: Formula
    Answered my own Q,
    I created a SQL command and used that to populate the parameter field.

  • How can I sort pictures by date and than by time stamp ?

    The approx. 2.000 pictures was taken by two cameras.
    Both cameras intern date and time where adjusted before the for session.
    It seems that Aperture 3.3.1 can´t manage it, can it?
    In the browser there is only one common field for date and time.
    I shoot the picture with two Canon 5D Mark II and Mark-III in JPG and RAW mode.
    The file name only is totally confusing for sorting.
    Like IMG_0008, _MG_0022 for Mark-II
    and
    _L2A8410 for Mark-III.

    Hi,
    I am not sure, which sort order you want to achieve? If you sort by the date field, the images will be sorted chronologically, ascending or descending, according to date and time - isn't what what you want?
    Can it be that you have a time zone problem? Compare the dates on the images that should be sorted side by side.
    Unless you specify "Camera Time" and "Actual Time" on import, Aperture will assume that the camera time has been your current system time.
    Canon 5D Mark II and Mark-III
    And unfortunately, both your cameras are exactly the two cameras that I know, where the time zone correction in Aperture is buggy and does not have much effect. I cannot find the discussion again right now, but look for a thread by Frank Caggiano on time zone correction.
    Regards
    Léonie

  • Using Numbers to shedule sort problem

    I am using Numbers to schedule the times that groups perform at an event I am organizing. If I make a time change to a group Numbers has also tagged this with the date of my entry and this affects the sorting. Is there a way to turn this off? I have set the column so that only the time shows but the date of entry still affects the sorting.
    Thanks!

    Hi,
    I'm new to Numbers as well, and trying to get my head around the effects of the different time/date treatment from that of AppleWorks.
    You may find useful information in the Numbers User Guide supplied with your copy of Numbers. Try searching "timevalue". The TIMEVALUE() function is discussed on page 282, but the search will bring up a number of pages that may offer alternate solutions.
    Also, check Yvan's post What you wanted to know about Time values in this forum.
    A possible solution:
    Click on the header row of an empty column and enter the following:
    =IF(ISBLANK(time),"",TIMEVALUE(time))
    After entering the formula as shown, Select the word "time" then click on the column header or column reference tab for the column containing the scheduled performance times. repeat for the second word "time". Click the checkmark to confirm the formula.
    Click on the column header cell of the column containing the formula and enter "Sort" (without the quotes, and with or without the capitalized S). Use this column to sort the table.
    Regards,
    Barry
    Note: Performances scheduled for after midnight will sort to the top of the list. There's probably a workaround if one is needed.
    B

  • Locking and sorting columns

    This is what I am trying to do:
    Lock the information in column A so it always stays there (1st, 2nd , 3rd, etc.)
    Sort Column C (total winnings) in descending order and keep the coresponding participants (column B ) with the amount.
    Create a value in Column D (4 behind Leader) that shows the difference between C3 and C4, C3 and c5, etc.
    The amounts and names are  filled from another sheet and change weekly. I can sort based on total winnings and the names follow. I can also create a formula to show the difference between the Leader and the next place participant however when I do a sort based on Total Winnings after the new values each week the Place and $Behind Leader always shift up and down. The information in Column A seems "locked" to the information in Columns B and C. The refernce in Column D is always Chris's amount and I want it to be refenced to the 1st place Participant.
    I hope I've explained this.
    Thanks - James
    2013 Standings
    Place
    Participant
    Total Winnings
    $ Behind Leader
    1st
    Chris
    $24.00
    2nd
    Ken
    $22.00
    -$2.00
    3rd
    Paul
    $20.00
    -$4.00
    4th
    Josh
    $18.00
    5th
    Kelly
    $16.00
    6th
    Greg
    $14.00
    7th
    Dave
    $12.00
    8th
    Darren
    $10.00
    9th
    Don
    $8.00
    10th
    Tony
    $6.00
    11th
    Suzanne
    $4.00
    12th
    James
    $2.00
    13th
    Spare 1
    $0.00
    14th
    Spare 2
    $0.00
    15th
    Spare 3
    $0.00
    16th
    Spare 4
    $0.00
    17th
    Spare 5
    $0.00
    18th
    Spare 6
    $0.00
    19th
    Spare 7
    $0.00
    20th
    Spare 8
    $0.00

    Hi j&s,
    Numbers uses a data base model that treats each row of a table as a single record. You can sort all or selected rows on the values in one or more column(s), but the whole row moves to maintain the integrity of each record.
    If you want some columns to be excluded from a sort, you need to remove those columns (or their data) from the table. Jerry has offered a way to do that for the rankings, but that solution will not resolve the issue of the 'leader board' cells acting badly in a sort.
    Here's an alternate. The first view is of the table(s) (with the participants in alphabetical order), just after the current totals had been entered.
    At this point, the Leader board, which pulls names and totals from the first three body rows of the data table, shows the correct cells, but these don't include the correct information.
    Note that column A does show the correct placing for each participant.
    The second view shows the same table(s) after the data table has bee sorted. The sort may be descending on column C (Totals) or ascending on column A (Place).
    Place is calculated from the Total values, using this formula:
    A2: =RANK(C2,C,largest-is-high)
    Fill down into the rest of the cells in column A. Any empty rows should be removed from the bottom of the table, or have zeros entered into their total column cells.
    The Leader board table has two formulas:
    A2: =OFFSET(Data :: $A$1,ROW()-1,1)
    Fill down to A4.
    This returns the name of the participant in the top body cell of column B of the data table.
    B2 contains the word "Leader"
    B3: =IF((OFFSET(Data :: $A$1,1,2)-OFFSET(Data :: $A$1,ROW()-1,2))>0,OFFSET(Data :: $A$1,1,2)-OFFSET(Data :: $A$1,ROW()-1,2),"Leader")
    Fill down to B4
    The root of this formula is OFFSET(Data :: $A$1,1,2)-OFFSET(Data :: $A$1,ROW()-1,2)
    This returns the total value from the first and second body cells in the total column, and subtracts the second from the first.
    The rest of the formula is an IF statement tohandle the occasions where there's a two or three-way tie for the lead. (image below) If the result is greater than zero, the subtraction is repeated and the result returned to the cell (B3); if the result is zero, the word :Leader: is returned to this cell.
    Placing the calculation in a separate table and using OFFSET, with a base cell (Data::A1) that is in a row defined as a Header row makes this table and its formulas immune from sorting of the Data table.
    Here's the tie, which arose when i added another 11 particpants to check sorting of the Place column:
    Regards,
    Barry
    Message was edited by: Barry (added image and notes on Tie case)

  • Defining sort order using parameter fields

    Post Author: vandersee
    CA Forum: General
    I've created a report, the contents of which is sorted depending on a parameter selected (method used is as described in the help topic entitled "Defining sort order using parameter fields".  Is it possible to vary the Sort Direction (ascending/descending) using parameters also, so that if I choose to sort by field A it will be ascending, but descending if I choose to sort by field B?

    Post Author: V361
    CA Forum: General
    You can create a Parameter {?Sort Order}  make it a string, and add items A to Z and Z to A and a formula and sort the group using the formula.
    Group Expert, select the group, select options, check use a formula as group sort order
    if {?Sort Order} = "A to Z" then crAscendingOrder else crDescendingOrder
    And your group will sort based on what is selected in the parameter.

  • Dynamic Sorting

    Is it possible to let users re-sort data in a Crystal Report by just clicking on a column heading? 
    For example the default sort is by name . . .
    Name                 Zip
    Jane Doe           60999
    Sue Smith          60001
    but the user re-sorts by zip by clicking the zip heading/column . . .
    Name                 Zip
    Sue Smith          60001
    Jane Doe           60999
    If possible please advise how to construct.  Your help is appreciated.

    I created a prompt sort option for my reports, which allows you to sort by none or any number of fields on the report, it is not static.
    1. Find the total number of sorts you will have for the report (in my case, 8).
    2. Create a formula for EACH sort i.e. "Sort Group 1", "Sort Group 2", etc
    3. I then created a prompt called "Sort Option" - Multiple values, optional (CR 2008), Number. I assigned 1 - 8 with descriptions of my fields I wanted to sort by.
    4. For "Sort Group 1" I used this formula:
    numbervar array sort;
    redim sort [8];
    local numbervar i;
    for i := 1 to 8 step 1 do
          sort<i> = i;
    local numbervar h;
    if (hasvalue({?Sort Option}) then
    for h := 1 to ubound({?Sort Option}) step 1 do 
         sort[h] := {?Sort Option)[h];
    select sort[1]
    case 1: {xxx.Customer}
    case 2: totext({xxx.sale_Date})
    etc etc etc
    5.  Use this formula for EACH 'Sort Group X" formula, and simply change the "select sort[x]" as needed.
    6. Assign a group to each "Sort Group number, suppressing headers and footers as needed. 
    This will allow you to select on your parameter, in order, the sorting that you want.  The sorts will cascade to whatever you select, and in the order you select them.
    HTH
    Chad

  • Is it possible to do sorting on multiple field inside a GROUP

    Hi
    I am wondering if it is possible to do a multiple sorting on multiple column/fields?
    When I right click on Change Group on the report
    on the "Change Group Options" window, it only has one field which allow you to sort in ascending/ descending order.
    I notice that it also has another checkbox which called Use a formula as Group Sort order, I am not quite sure how to use it to sort multifield/column.
    E.g.
    I have a table which has 5 fields
    I would like to sort it by TotalSpend, TotalEarned, Department, ...etc
    I would be grateful, if you can show me how to do a group sorting for multi column/fields
    Thanks in advance.

    To Sastry,
    Thanks for your information, unfortunately, I am using Crystal report XI.
    To Sandra,
    <<Yes, go into the Group expert and select them in the order in which you want them sorted>>
    Do you mean create different group to do the sorting?
    Could you show me how to create a formula which allow crystal report to do the sorting on multi-field.
    Thanks in advance.

  • Cross Tab Sort and Exclusion

    I have a cross tab that maps closing dates over the prior 13 months and looks like this: 
                    Total
            Total          3,004
         Sep-08     137
         Aug-08     220
         Jul-08     251
         Jun-08     201
         May-08     168
         Apr-08     263
         Mar-08     212
         Feb-08     163
         Jan-08     142
         Dec-07     100
         Nov-07     176
         Oct-07     149
         Sep-07     109
         Jan-00     713
    I have mapped everything that is not within the prior 13 month range to Jan 1, 2000.  I have used record selection to grab records based on multiple criteria.  It looks at cases opened in the prior 13 months and cases closed in the prior 13 months.  This looks at opened and closed dates.  The 713 is just everything in the past 13 months that doesn't have a closed date.  When I don't map it to Jan-00 it displays a blank row.  I tried to do a specific order sort but when I ran my report today it did not include Sep-08, not that its difficult to add the month once a month, but is it possible to exclude Jan-00 when its printing the cross-tab and then sort the remaining ones in descending order [most recent month prior to oldest]?  I am new to Crystal Reports.  I thought it may be in the Formula as Group Sort Order and something like this
    if {@Closed Month}= date(2000,01,01) then [not sure of what function to exclude] else {@Closed Month} crDescendingOrder
    thank you all for the support so far

    Try using group selection formula like
    {@Closed Month}<>date(2000,01,01)
    to exclude JAN data.
    Regards,
    Raghavendra

  • Record Group - Sorting.

    Hi,
    I am using D2K 1.6.1 on HP-Ux with Oracle 7.3.
    Is there a easy way to sort the record group, other than re-populating the group by query?
    I populate the record group once depending upon the i/p criteria. From there I display those columns on multi record block. Now the user needs an option to sort by any of the displayed column. I can do this by re-querying, but that there will be performance issues involved. I can sort the column in the old fashion way, but just wanted to know if there is a easy way out.
    Thanks in advance.
    Sanjay.

    Create a formula like this
    tonumber({DISCOUNT_RECORD.RECORD_NUMBER})
    Now insert a group on this formula that automatically sorts in ascending order
    Regards,
    Raghavendra

Maybe you are looking for

  • Need advice on Hardware & Disk Setup for Premiere Pro CS6

    I am about to purchase a Mac Pro and after reading threads on hardware requirements & different disk setups I am still a little unsure which way to go. If someone could point me in the right direction would be greatly appreciated. Firstly this system

  • Payment document

    Hi, i have the clearing document number. I dont know for which Miro,Po document it came.I check by clicking original document it is not going please advice rgds sp

  • XML: empty tag issue

    I use Transformer class to convert xml Document into string representation: StringWriter sw = new StringWriter();      TransformerFactory transFactory = TransformerFactory.newInstance(); Transformer transformer = transFactory.newTransformer(); transf

  • Sending photos from ipad air

    Hi, all. I have an ipad air.  It is not connected to any other device and cannot be linked to my MacBook.  I have taken some photos with my air and I want to email them to someone else, but I can't find a way to do this. Anyone know how?

  • Connecting an IdeaPad U400 to a HDMI receiver

    Hi group.  I have a U400 with all the latest drivers running on Windows 8.  I can connect the laptop to a projector/monitor directly, but I can't connect to the projector/monitor via an HDMI receiver (Denon 889).  The laptop can't detect the external