JScrollPane.setRowHeaderView() and Row Numbers
Hello there,
I am writing an editor using JEditorPane and am using JScrollPane's
setRowHeaderView() method to set row numbers. The code next shows how I am
doing it.
Now the problem is after I make a change in the editor, I am not able to see the
rownumbers from one even when I am at the top of the editorpane. But if I resize
the editorpane (which is in a frame) then I am able to see the row numbers from one.
Also, if I scroll up and down then the row numbers are seen properly from one. When the editor opens for the first time I am able to see the row numbers from the beginning i.e. one.
I think some where I am not calling revalidate(), validate(), or repaint()
properly. Please help. Thank you.
//method one
//Rownumbers
rowNums = new PreferenceJTextArea();
rowNums.setEditable(false);
rowNums.setMargin(new Insets(topMargin, 0, 0, 0));
rowNums.setAlignmentX(Component.LEFT_ALIGNMENT);
rowNums.setFont(myFont);
int maxNumOfLines = setRowNums(displayFormat);
rowNums.setBackground(Color.lightGray);
mainScrollPane.setRowHeaderView(rowNums);
// end method one
//============================================================
// method two
public int setRowNums(int dispFormat) {
StringBuffer str = new StringBuffer();
int numOfLines = seq.getLineCount(dispFormat);
for (int i = 1; i < (numOfLines + 1); i++) {
str = str.append(String.valueOf(i)).append("\n");
rowNums.setText(str.toString());
rowNums.validate();
rowNums.revalidate();
rowNums.repaint();
return numOfLines;
// end method two
//============================================================
// after making an editing change method three is called.
// method three
setRowNums(displayFormat); // this is where the text in the textarea gets
// changed and causes unwanted results
mainScrollPane.validate();
mainScrollPane.revalidate();
this.validate();
this.repaint();
// end method three
Hello,
I have few questions regarding the proposed solutions.
1) In my application there is word wrapping, i.e. I am manually wrapping the text and not Java's inherent functionality.
2) There will be cases when the font size will be changed for the entire application. Though for a given document the font size will remain same.
3) Most of the time the application will be opening an existing files.
Hence, my question is will the proposed solutions still work. Also there is an overlap in the sense the solution using ViewFactory and EditorKit.
Pl do let me know if you have any idea wrt to any of the concerns posted here.
Thanks once again.
ac
Similar Messages
-
How can I make the rolumn and row headers appear on the printed sheet?
I am working in Numbers'09. I want to print out my chart with the column letters and row numbers showing.
How can I make the rolumn and row headers appear on the printed sheet?g,
Those annotations are called "Labels", and they are only visible during editing when a cell selection is made within the table. If you need to have the labels on your final output, you can create labels in Text Boxes and position them adjacent to the table.
Jerry -
Finding missed sequence numbers and rows from a fact table
Finding missed sequence numbers and rows from a fact table
Hi
I am working on an OLAP date cube with the following schema:
As you can see there is a fact transaction with two dimensions called cardNumber and Sequence. Card dimension contains about three million card numbers.
Sequence dimension contains a sequence number from 0 to 255. Fact transaction contains about 400 million transactions of those cards.
Each transaction has a sequence number in 0 to 255 ranges. If sequence number of transactions of a card reaches to 255 the next transaction would get 0 as a sequence number.
For example if a card has 1000 transactions then sequence numbers are as follows;
Transaction 1 to transaction 256 with sequences from 0 to 255
Transaction 257 to transaction 512 with sequences from 0 to 255
Transaction 513 to transaction 768 with sequences from 0 to 255
Transaction 769 to transaction 1000 with sequences from 0 to 231
The problem is that:
Sometimes there are several missed transactions. For example instead of sequence from 0 to 255, sequences are from 0 to 150 and then from 160 to 255. Here 10 transactions have been missed.
How can I find all missed transactions of all cards with a MDX QUERY?
I really appreciate for helpsThank you Liao
I need to find missed numbers, In this scenario I want the query to tell the missed numbers are: 151,152,153,154,155,156,157,158,159
Relative transactions are also missed, so I think it is impossible to get them by your MDX query
Suppose this:
date
time
sequence
20140701
23:22:00
149
20140701
23:44:00
150
20140702
8:30:00
160
20140702
9:30:00
161
20140702
11:30:00
162
20140702
11:45:00
163
As you can see the sequence number of the last transaction at the 20140701 is 150
We expecting that the first transaction of the next day should be 151 but it is 160. Those 10 transactions are totally missed and we just need to
find missed sequence numbers -
Displaying Row and Column Numbers
I see through other research on Oracle SQL Developer that I should be able to display the row and column numbers on version 1.5.4, but I don't see where to go to turn this on. Suggestions?
Suggestions?Ask in the SQL Developer forum?
-
Transpose columns and rows in numbers
I need to transpose columns and rows in Numbers and I do not want to write script to do it. Is there an easier way?
Give me a proper transpose and I will uninstall Excel and never look back.
Ok, here's a proper transpose, that can be placed in an Automator Service so it becomes a simple menu pick as below (and can also be assigned a keyboard shortcut).
To use it (this is slightly different from Excel) you select the range you want to transpose, choose Copy Transpose, click a destination cell in an existing table in the current document or another document, and command-v (Edit > Paste) or option-shift-command-v (Edit > Paste and Match Style).
The one-time setup is as follows. In Automator choose File > New > Service, drag a Run AppleScript action from the left into the right pane, choose 'No Input' for 'Services receives selected' and 'Numbers' for 'in'. Then paste the following into the Run AppleScript action, replacing all text already there by default:
--Transpose - select range, run, paste transposed values where wanted
try
tell application "Numbers" to tell front document to tell active sheet
set selected_table to first table whose class of selection range is range
tell selected_table
set my_selection to the selection range
set first_col to address of first column of my_selection
set last_col to address of last column of my_selection
set first_row to address of first row of my_selection
set last_row to address of last row of my_selection
set str to ""
repeat with i from first_col to last_col
repeat with j from first_row to last_row
set str to str & (value of cell j of column i of selected_table) & tab
end repeat
set str to str & return -- add line return after row
end repeat
end tell
end tell
set the clipboard to str
display notification "Ready to paste transposed values" with title "Numbers"
on error
display dialog "Select a range first and then try again"
end try
--end script
Hit the compile "hammer" and the script should indent properly. Then save the service with the name you want to appear in your menu, and it will thereafter be available via the Services menu (and keyboard shortcut, if you set one up in System Preferences > Keyboard > Shortcuts > Services).
That's it. Less then five minutes' one-time set-up work and you've got a menu pick for a transpose functionality that is as convenient as Excel's.
SG -
Numbers-freezing columns and rows
Can you freeze columns and rows in numbers although they are not designated as headers?
FYI I was looking for information in these old posts on the Freeze function in Numbers.
After looking through numerous posts and finally talking with an Apple Tech, we found that the freeze function was not in Number 08, but added in Number 09. We were both surprised that this basic spreadsheet function was missing from 08
With this function you can lock/freeze the top row and/or column so as you scroll through the spreadsheet, you can see you first rows or columns while looking at the data in the middle of the spreadsheet.
I am not an Apple representative, but the only way to fix this and other flaws in Number 08 is to upgrade to 09 for $19.99. Hope this helps. -
Print Row Numbers and Column Letters
How do you tell Numbers to print the Row numbers and Column letters? This was very simple in Appleworks (print dialog box had that option). Can't find it in Numbers though.
Here is a script doing all the job for us.
Just select one or several cells in a table and run the script.
It duplicates it, add an header row, an header column, insert the needed labels and fill the other cells with a formula grabbing the contents of the original table.
--[SCRIPT build a table with headers]
Enregistrer len tant que Script: build a table with headers.scpt
déplacer le fichier créé dans le dossier
<VolumeDeDémarrage>:Users:<votreCompte>:Library:Scripts:Applications:Numbers:
Il vous faudra peut-être créer le dossier Numbers et peut-être même le dossier Applications.
Selectionner une cellule dans la table à dupliquer
menu Scripts > Numbers > build a table with headers
Le script duplique la table et crée des en-têtes de lignes et colonnes.
--=====
L'aide du Finder explique:
L'Utilitaire AppleScript permet d'activer le Menu des scripts :
Ouvrez l'Utilitaire AppleScript situé dans le dossier Applications/AppleScript.
Cochez la case "Afficher le menu des scripts dans la barre de menus".
+++++++
Save the script as Script: build a table with headers.scpt
Move the newly created file into the folder:
<startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:Numbers:
Maybe you would have to create the folder Numbers and even the folder Applications by yourself.
Select a range of cells in the table to 'duplicate'
menu Scripts > Numbers > build a table with headers
The script duplicate the table and inserts columns/rows headers.
--=====
The Finder's Help explains:
To make the Script menu appear:
Open the AppleScript utility located in Applications/AppleScript.
Select the "Show Script Menu in menu bar" checkbox.
--=====
Yvan KOENIG (VALLAURIS, France)
2009/09/19
--=====
property theApp : "Numbers"
--=====
my activateGUIscripting() (* to be sure than GUI scripting will be active *)
set {d_Name, s_Name, t_Name, r_Name} to my getSelection()
if r_Name is missing value then
if my parleAnglais() then
error "No selected cells"
else
error "Il n'y a pas de cellule sélectionnée !"
end if
end if
set new_Table to t_Name & "_#"
my duplicateTable(s_Name, t_Name, new_Table)
set delim to my getLocalizedDelimiter()
(* grab localized function names and add an open parenthesis at end *)
set IF_loc to my getLocalizedFunctionName("Numbers", "IF") & "("
set CHAR_loc to my getLocalizedFunctionName("Numbers", "CHAR") & "("
set INT_loc to my getLocalizedFunctionName("Numbers", "INT") & "("
set MOD_loc to my getLocalizedFunctionName("Numbers", "MOD") & "("
set INDIRECT_loc to my getLocalizedFunctionName("Numbers", "INDIRECT") & "("
set ADDRESS_loc to my getLocalizedFunctionName("Numbers", "ADDRESS") & "("
(* grab localized function names and add a couple of parenthesis at end *)
set ROW_loc to my getLocalizedFunctionName("Numbers", "ROW") & "()"
set COLUMN_loc to my getLocalizedFunctionName("Numbers", "COLUMN") & "()"
tell application "Numbers" to tell document d_Name to tell sheet s_Name to tell table new_Table
if column count = 256 then
if my parleAnglais() then
error "Oops, already 256 columns !"
else
error "Désolé, il y a déjà 256 colonnes !"
end if
end if
if row count = 65536 then
if my parleAnglais() then
error "Oops, already 65536 rows !"
else
error "Désolé, il y a déjà 65536 lignes !"
end if
end if
try
add row above row 1
on error
if my parleAnglais() then
error "Oops, already five header row !"
else
error "Désolé, il y a déjà cinq rangs d’en tête !"
end if
end try
try
add column before column 1
on error
if my parleAnglais() then
error "Oops, already five header columns !"
else
error "Désolé, il y a déjà cinq rangs d’en tête !"
end if
end try
set nbr to row count
set nbc to column count
(* =IF(COLUMN()<28,CHAR(COLUMN()63),CHAR(INT((COLUMN()-2)/26)+64)&CHAR(MOD(COLUMN()-2,26)65)) *)
set theFormula to "=" & IF_loc & COLUMN_loc & "<28" & delim & CHAR_loc & COLUMN_loc & "+63)" & delim & CHAR_loc & INT_loc & "(" & COLUMN_loc & "-2)/26)+64)&" & CHAR_loc & MOD_loc & COLUMN_loc & "-2" & delim & "26)+65))"
tell row 1
repeat with c from 2 to nbc
set value of cell c to theFormula
end repeat
end tell -- row 1
(* =ROW()-1 *)
set theFormula to "=" & ROW_loc & "-1"
tell column 1
repeat with r from 2 to nbr
set value of cell r to theFormula
end repeat
end tell -- column 1
(* =INDIRECT(ADDRESS(ROW()-1,COLUMN()-1,,,"Tableau 2")) *)
set theFormula to "=" & INDIRECT_loc & ADDRESS_loc & ROW_loc & "-1" & delim & COLUMN_loc & "-1" & delim & delim & delim & quote & t_Name & quote & "))"
repeat with r from 2 to nbr
repeat with c from 2 to nbc
set value of cell r of column c to theFormula
end repeat -- with c
end repeat -- with r
end tell -- Numbers
--=====
Set the parameter delimiter which must be used in Numbers formulas
on getLocalizedDelimiter()
if character 2 of (0.5 as text) is "." then
return ","
else
return ";"
end if
end getLocalizedDelimiter
--=====
on getLocalizedFunctionName(theApp, x)
local p2bndl
set p2bndl to (path to application support as text) & "iWork '09:Frameworks:SFTabular.framework:Versions:A:Resources:"
return my getLocalizedName(theApp, x, p2bndl)
end getLocalizedFunctionName
--=====
on getLocalizedName(a, x, f)
tell application a to return localized string x from table "Localizable" in bundle file f
end getLocalizedName
--=====
on getSelection()
local _, theRange, theTable, theSheet, theDoc, errMsg, errNum
tell application "Numbers" to tell document 1
repeat with i from 1 to the count of sheets
tell sheet i
set x to the count of tables
if x > 0 then
repeat with y from 1 to x
try
(selection range of table y) as text
on error errMsg number errNum
set {_, theRange, _, theTable, _, theSheet, _, theDoc} to my decoupe(errMsg, quote)
return {theDoc, theSheet, theTable, theRange}
end try
end repeat -- y
end if -- x>0
end tell -- sheet
end repeat -- i
end tell -- document
return {missing value, missing value, missing value, missing value}
end getSelection
--=====
on decoupe(t, d)
local l
set AppleScript's text item delimiters to d
set l to text items of t
set AppleScript's text item delimiters to ""
return l
end decoupe
--=====
on isItAsheet(s)
try
tell application "Numbers" to tell document 1
count of tables of sheet s (*
Post an error if s is not a sheet *)
end tell
return true
on error
return false
end try
end isItAsheet
--=====
on activateGUIscripting()
tell application "System Events"
if not (UI elements enabled) then set (UI elements enabled) to true (* to be sure than GUI scripting will be active *)
end tell
end activateGUIscripting
--=====
on duplicateTable(sourceSheet, sourceTable, newName)
local lesFeuilles, lesTables1, found, listOfRows, cor, i, isSourceSheet, nameI, j, lesTables2
tell application "Numbers"
activate
tell document 1
set lesFeuilles to name of sheets
if sourceSheet is in lesFeuilles then
tell sheet sourceSheet to set lesTables1 to name of tables
if sourceTable is not in lesTables1 then
if my parleAnglais() then
error "The sheet “" & sourceTable & "” of sheet “" & sourceSheet & "” is unavailable ! "
else
error "La table “" & sourceTable & "” de la feuille “" & sourceSheet & "” n'existe pas ! "
end if
end if -- sourceTable is not
else
if my parleAnglais() then
error "The sheet “" & sourceSheet & "” is unavailable ! "
else
error "La feuille “" & sourceSheet & "” n'existe pas ! "
end if
end if -- sourceSheet is in
end tell -- document
end tell -- application
if newName is not in lesTables1 then (*
Now, an ugly workaround to duplicate the sheet *)
set isOS4 to (system attribute "sys2") < 5
tell application "System Events" to tell application process "Numbers"
set docWindow to false (* CAUTION, an inspector ("AXFloatingWindow") or a Find/Search ("AXDialog") window may be open *)
repeat with i from 1 to (count of windows)
if subrole of window i is "AXStandardWindow" then
set docWindow to i (* got the document's window *)
exit repeat
end if
end repeat
if docWindow is not false then
tell outline 1 of scroll area 1 of splitter group 1 of splitter group 1 of window docWindow
select row 1
set value of attribute "AXFocused" to true
set found to false
set listOfRows to name of static text of every row
set cor to count of rows (* equal count of listOfRows *)
if isOS4 then (*
for mac Os X 10.4.11
CAUTION, listOfRows it's a list of lists !
{{"Feuille 2"}, {"Tableau 1"}, {"theSheet"}, {"Feuille 1"}, {"Tableau 2"}, {"Clément"}, {"Feuille 4"}} *)
repeat with i from 1 to cor (*
Scan the thumbnails *)
set nameI to item 1 of item i of listOfRows
set isSourceSheet to (sourceSheet = nameI) and my isItAsheet(nameI)
if isSourceSheet then
select row i
if (i < cor) and not my isItAsheet(item 1 of item (i + 1) of listOfRows) then (*
Here we may scan the thumbnails of tables of sourceSheet *)
repeat with j from i + 1 to i + (count of lesTables1)
if sourceTable = item 1 of item j of listOfRows then
select row j
set found to true
exit repeat
end if -- sourceTable
end repeat
else
if my parleAnglais() then
error "The sheet “" & sourceTable & "” of sheet “" & sourceSheet & "”" & return & " is not revealed in thumbnails ! "
else
error "La table “" & sourceTable & "” de la feuille “" & sourceSheet & "”" & return & " n'est pas affichée dans les vignettes ! "
end if -- my parleFrancais
end if -- (i < cor)
end if -- isSourceSheet
if found then exit repeat
end repeat -- i
else (*
for mac Os X 10.5.x
CAUTION, listOfRows is a list of lists !
{{}, {"Tableau 1"}, {"theSheet"}, {}, {"Tableau 2"}, {"Clément"}, {}}
With 10.5.x, the names of sheets are empty *)
repeat with i from 1 to cor
set isSourceSheet to (class of UI element 1 of row i is group) and (get value of static text 1 of group 1 of row i) is sourceSheet
if isSourceSheet then (*
Here we may scan the thumbnails of tables of sourceSheet *)
if value of UI element 1 of group 1 of row i is 0 then (*
reveal the tables's thumbnails and adjust the list accordingly *)
click UI element 1 of group 1 of row i (* click the black triangle to reveal tables *)
delay 0.1
set listOfRows to name of static text of every row (* update the list accordingly *)
end if -- value of UI…
repeat with j from i + 1 to i + (count of lesTables1)
if sourceTable = item 1 of item j of listOfRows then
select row j
set found to true
exit repeat
end if -- sourcetable
end repeat -- with j
end if -- isSourceSheet
if found then exit repeat
end repeat -- with i
end if -- check OS
end tell -- outline …
keystroke "d" using command down
end if -- docWindow
end tell -- System Events…
if docWindow is not false then (*
Rename the new table according to the passed name: newTable *)
tell application "Numbers" to tell document 1 to tell sheet sourceSheet
set lesTables2 to name of tables
repeat with i in lesTables2
if i is not in lesTables1 then (*
Here i is the name of the newly created table *)
set name of table i to newName
exit repeat
end if
end repeat
end tell
end if -- docWindow
end if -- newName is not…
end duplicateTable
--=====
on parleAnglais()
local z
try
tell application theApp to set z to localized string "Cancel"
on error
set z to "Cancel"
end try
return (z is not "Annuler")
end parleAnglais
--=====
--[/SCRIPT]
Yvan KOENIG (VALLAURIS, France) samedi 19 septembre 2009 17:33:59 -
How to keep the horizontal top column letters and left row numbers????
When working on a table, there is a vertical column on the left of the row numbers and a row across the top with letters that identify columns. I would like to keep this (as in Appleworks) but whenever I click on the table, or use Print View, or Print, these two identifying features disappear! I have tried everything to keep them, but no luck. Is there any way to do this?
thanksHello
may you take care of the existence of the Search field on the right side of this forum?
may you also look at the already existing threads (at least in the first two pages).
Your question is available four or five rows below yours.
Using it with the button more options and selecting The Numbers forum
enter the keywords lock AND title .
You will discover that yoy may get quick respnce to a lot of questions without asking for them in the forums.
I know that some posters dislike this kind of response.
I think that it's more useful to teach how to fish than to give a fish
Yvan KOENIG (from FRANCE mercredi 23 janvier 2008 15:52:01) -
Displaying row numbers in tables
Is there a way to get JTable to display row numbers on the left-most side of the table? Are there any functions in JTable that will allow you to do this?
I am thinking that to do this, I will probably need to add a column to my table model and make the first column and uneditable JLabel that shows the row number.
Thanks for any help.
Mike RyanOk , the class i am pulling this code from is 500+ lines of code, so I will try to pull out only the important pieces.
private DefaultTableModel theNorthernModel;
private JTable theNorthernTable;
private DefaultTableCellRenderer[] theRenderer;
private JScrollPane theNorthernPane;
private Object[] rowTitles = {"1", "2", "3", "4", "5", "6", "7"};//
private Object[] colTitles = {"one","two","three","four","five","six"};
theNorthernModel = new DefaultTableModel(rowTitles.length,colTitles.length);
theNorthernTable = new JTable(theNorthernModel);
theNorthernTable.setCellSelectionEnabled(false);
theNorthernTable.setEnabled(false);
theNorthernTable.getTableHeader().setReorderingAllowed(false);
theNorthernPane = new JScrollPane(theNorthernTable);
theNorthernPane.setPreferredSize(new Dimension(600, 150));
//this is the stuff you want
ListModel listModel = new AbstractListModel() {
public int getSize() {
return rowTitles.length;
public Object getElementAt(int index) {
return rowTitles[index];
JList rowHeader1 = new JList(listModel);
rowHeader1.setBackground(theNorthernPane.getBackground());
rowHeader1.setFixedCellWidth(140);
theNorthernPane.setViewportView(theNorthernTable);
theNorthernPane.setRowHeaderView(rowHeader1);
rowHeader1.setCellRenderer(new RowHeaderRenderer(theNorthernTable));
theRenderer = new DefaultTableCellRenderer[6];
for(int i = 0; i< 6; i++) {
theRenderer[i] = new DefaultTableCellRenderer();
theColumnModel = (DefaultTableColumnModel)theNorthernTable.getColumnModel();
* RowHeaderRenderer renders the panel's rows
class RowHeaderRenderer extends JLabel implements ListCellRenderer {
* Constructor creates all cells the same
* To change look for individual cells put code in
* getListCellRendererComponent method
RowHeaderRenderer(JTable table) {
JTableHeader header = table.getTableHeader();
setOpaque(true);
setBorder(UIManager.getBorder("TableHeader.cellBorder"));
setHorizontalAlignment(CENTER);
setForeground(header.getForeground());
setBackground(header.getBackground());
setFont(header.getFont());
* Returns the JLabel after setting the text of the cell
public Component getListCellRendererComponent( JList list,
Object value, int index, boolean isSelected, boolean cellHasFocus) {
setText((value == null) ? "" : value.toString());
return this;
} -
White row numbers in rowheader when scrolling
I'm using a JTable as a row header in a JScrollPane. When i scroll the data table, header table scrolls but row numbers looks bad repainted white squares. I found some posts talking about this issue but I didn't find the answer, could anyone tell me if i'm missing something?
here's my code
Header class:
public class JPdfSelectionTableRowHeader extends JTable {
private static final long serialVersionUID = 9074507882735673054L;
private JTable mainTable;
public JPdfSelectionTableRowHeader(JTable table){
super();
mainTable = table;
setAutoCreateColumnsFromModel(false);
setModel(mainTable.getModel());
setAutoscrolls(false);
setFocusable(false);
setRowSelectionAllowed(false);
addColumn(new TableColumn());
getColumnModel().getColumn(0).setCellRenderer(getDefaultRenderer(Integer.class));
getColumnModel().getColumn(0).setPreferredWidth(20);
setPreferredScrollableViewportSize(getPreferredSize());
public boolean isCellEditable(int row, int column){
return false;
public Object getValueAt(int row, int column){
return new Integer(row + 1);
public int getRowHeight(int row){
return mainTable.getRowHeight();
public boolean isFocusTraversable(){
return false;
}and how i'm using it:
JViewport viewPort = new JViewport();
viewPort.setView(new JPdfSelectionTableRowHeader(mainTable));
tableScrollPane.setRowHeader(viewPort);Thank youWell it looks like you copied my "Line Number Table" (without the spaces) example, which works fine for me.
I have no idea why your code won't work given that the code you posted is not compileable and therefore not executable. -
How to print a report without row numbers or grid lines?
Is there a way to print a Discoverer report without row numbers or grid lines?
Thank you.
BlakeHi Blake
You're not doing anything wrong.
The settings made when you use Tools | Options | Sheet are global settings that are only applied to new workbooks and worksheets going forwards. These have no impact on existing worksheets or even the one you currently have open. This is because Discoverer does not know whether your original worksheets were setup in a certain way deliberately as opposed to inheriting the global settings as they were at that time. What this also means, reading between the lines, is that these settings must then be stored within the worksheet itself, and this is exactly what happens.
Thus, to edit an existing worksheet's settings you need to open the worksheet, right-click in the sheet and from the popup select either Format Table or Format Crosstab depending upon the type of worksheet you are working with. After making any necessary changes you will need to save or re-save the workbook in order for those settings to be remembered for the next time.
Best wishes
Michael -
I see people from different ages at my work and every month I need to count how many people from each age I've seen that month. How can I do to give the entries to numbers in a single cell and make numbers count them for me? The final result would be a spreadsheet telling there were 8 people from 20 to 39 years old, 14 peolple from 40 to 59 and so on...
jpqcampos wrote:
This appears to be an 'input form' using 'Radio Buttons' to select the category. Neither of these features are supported in Numbers '09.
You can input the data on one table and summarize it on a second table, but the input table will continue to hold data for each event.
And by using the Reorganize button, you can hide all but two rows of that table to approximate the appearance and performance of an input form.
Here are the two tables, Data on the left and Summary on the right. Notes below.
The grey-filled columns in both tables are 'working' columns, and may be hidden (as shown in the image below).
Data table:
D1 contains the word "TRUE" (in capital letters). (This row is always shown.)
D2 is empty, or may contain any value except "TRUE" (This row is always hidden under the Reorganize rule.)The rest of Row 2 of this table requires the data shown: a number outside the range to be counted (999), and two checkboxes, both checked.
D3 (and filled down the rest of column D): =AND(OR(B2,C2),NOT(OR(B3,C3)))
The formula returns TRUE only for the first unused row in the table (ie. the first row for which neither checkbox has been checked)
Summary table:
Column A contains labels for the age ranges to be counted.
Column B contains the same information in the form necessary for the formulas in columns C and D. They need a numeric value, and that value must be the largest acceptable value in the range to be counted.
C2 (and filled right to column D, then both filled down to row 5):
=COUNTIFS(Data :: $A,"<="&$B,Data :: B,TRUE)-SUM(C$1:C1)
Two changes from the previous example:
COUNTIFS is used to separate the Native and Foreign counts as well as the age range to be counted.
The amount subtracted from each result is the SUM of the earlier results, and includes the text value in the first cell of the column (which is interpreted by SUM as a zero).
See note below regarding my earlier formula.
When the greyed columns are hidden and the checkbox in the Reorganize pane is checked, the two tables will appear as shown below:
Close the reorganize pane, and the 'data entry form' is ready to use.
To use, enter the age first, then check one of the boxes.
As soon as one box is checked, the row will be hidden, and the next (unused) row will be shown.
Regards,
Barry
Note regarding formula in my earlier post:
The earlier formula will give erroneous results as it subtracts only the count directly above it from its count of persons in the age range 0-n.
In E2 of that table, replace "-E1" with "-SUM(E1:E$1)
Fill down to E8.
Ignore the instructions (in that post) following "Fill down to E8."
B -
Is there a way to have a Numbers spreadsheet show the row numbers on ipad?
I am have a spreadsheet I am using for keeping count of the current people registered for an event.
If there a way to have one of the columns automatically show the row numbers so I can easily see the amount of people confirmed for the event without having to manually count them? Also, I will be adding and deleting lines and need Numbers to automatically show the row numbers without me having to change it.
Thanks,
MikeI found it out:
inserted a new column A
a --
In A1 type 1
in A2 type 2
select the pair A1:A2
drag the circular handle from the bottom right of A2 thru the very bottom of the column.
b --
in A1 type =ROW()
select the cell A1
drag the circular handle from the bottom right of A1 thru the very bottom of the column. -
I want to do a select query based on row numbers and was wondering if its possible.
for example,
select * from TABLE where rownumber = x;
Thanks.There is one special case where
SELECT * FROM table WHERE rownum = x
will work, x = 1. Note, the proper psuedo column name is ROWNUM.
You can do something like:
SELECT *
FROM (SELECT *,rownum rn
FROM table)
WHERE rn = xfor any value of rownum up to the number of rows in table.
TTFN
John -
Excel 2010 Row numbers disappearing
Question: Bit of an odd one here.
Running Excel 2010 on a WinXP Sp3 box. Issue is only affecting one user and one of his spreadsheets. Sporatically, the actual numbers within the row identifier boxes vanishes, along with the data in the affected rows. The rows are still there, and the rows
above and below are still numbered in the same sequencial order as if the affected rows were still numbered. If we do not notice this before saving spreadsheet, data is lost. If we unhide all cells, the numbers come back, as does the data. The odd thing is,
as I said, the rows are NOT actually hidden, only the row identifier numbers and the data are gone.
Please help! Critical order tracking sheet.Using Windows 7 Professional ver 6.1 (Build 7601 : Service Pack 1) and Excel version 14.0.6112.5000 (32 bit)
A large spreadsheet some 8MB and formatted as an xls file.
I experienced a similar problem with some row numbers and data missing together with some rows being expanded to a height of 550 pixels.
Highlighting the whole row and automatically resetting the height (double clicking bottom edge ) sometimes resets the height, row numbers and data.
Strangely highlighting the row and clicking the bold button also resets the the height, row numbers and data.
Unfortunately these remedy’s do not persist after saving the file and reopening it.
If I resave the "corrupted" xls version as a Macro-Enabled Worksheet .xlsm file all of the issues above disappear.
I hope this helps some one
Maybe you are looking for
-
HT1766 I have a problem with my iPhone 4S
I have a problem with my iPhone 4S. But I lost my purchase receipt/invoice. I still have original box with serial numbers etc. The phone is 18 months old. Can I get this fixed with Apple Gener Bar? Do I need the receipt?
-
hi, how to make blank space in video path to make work.java fx media player doesn`t work it throws illegal character exception.
-
Space which isn't there prints in a word
Some time back I produced a brochure for a friend in AW Draw. Some more copies are needed and I have changed from inkjet to laser printer (both Epson: Stylus C70 to Acculaser C2600). When I print one word now has a rogue space in it (word = 'large' w
-
When I close PDF files, Adober Reader continues to run in the background and slows down my computer. I have to go into Task Manager and close Adobe Reader each time. Any suggestions?
-
I am still having trouble with Lightroom recognizing PSD and some other updated files. All filters are off. I did the work in Bridge because of similar issues I've had with LR updating files. Now I just want the PSD files to show up so that I can use