Display, sort and filter numbers with multiple decimal in excel 2007 - excel

I'm using excel 2007.
I've a list of tasks (200-500) that I need to group in different category/section etc (multiple filters). Whole data is in excel table so I can apply Excel's build-in table filters to display exact data that I need.
However it is always difficult to apply multiple filter to display expected data, specially as I need to do it very frequently. To make things simple I'm planning to number each record like
a.b.c.d.e.f
Where a, b, c, d, e, f are simple numbers. List looks like:
1
1.1
1.2
1.2.1
1.2.1.1
1.2.2
1.3
& so on.
Problem is, Excel take it as number with single decimal but as soon as I add second decimal, excel treat it as text, which is obvious in general behavior.
However, as special case, I need excel treat both as number or text. Number is preferable as I want to sort them, which might be difficult as a text.
To make the things little more complex, while filtering in table, I require if I can add some formula to filter results like 1.* should display all numbers starts with 1.
Is it possible with excel's default behavior, without VBA?
If no, is it possible with VBA? If yes, any clue is appreciated. I don't need whole program as I can write basic VBA program, just a clue how it can be done?

I sort mine by adding a helper column that adds a letter to the front and sort on that. E.g. 1 becomes f1, 1.1 becomes f1.1 etc. Then all are sorted as text.
You can use the formula ="f" & A1.
My sample:
Then the data sorted:
And the filter:

If I were to try this without VBA, my first step would be to use the sort to columns function on the data tab.
Next make sure all empty spaces in your data are filled with zeros.
Then sort the data by column
as long as you left your original data in the same row as the sorted data (I didn't in the images posted to focus on the process), your items should now be in order.

Related

Custom format with custom Multiples Excel

I recently wanted to create an excel table to note all my electric components that I have so I can easily find the right component without searching every time for it.
The problem is, especially with capacitors, they come with a wide range of values generally for me between 220uF and 10pF, and I want to create a custom format to display the values properly in excel, for example if I put in a cell 0.00022 it shows 220uF or maybe 0.22mF (but 220uF is better) and not 2.2E-04 or any other format.
I tried the custom tool but I don't know how to add the micros, nanos and picos.
You can add conditions to the formatting, like:
[<0.00001] 0.00%%% "pF";[<0.001] 0.00% "uF";#
This will show 2.20%% uF in the cell (so you can multiply by using the percent sign, more details here).
Drawback: the percent signs are shown, and the Ctrl+J trick described on the link does not really work for me (and I personally find it as an ugly solution).
If I were you I'd add a new column called "Formatted" where I multiply the values with formulas. Like
=IF(A1<0.00001,A1*1000000 & "pF",IF(A1<0.001,A1*10000 & "uF"))
It's easier then to search in both columns (one is by formatted, like all "uF", other is by real Farad value. Also you could use the original column for sorting.

sum up days using only existing Excel formulas

I would like to sum up date periods and sum the days per item.
The input data will grow over time and new item categories can appear, so the items (number of rows) that show in the expected report can not be "hardcoded".
The input parameter is the from and to date that determines the period that must be considered. You can imagine this as a moving date window on the input data grid.
I am a Java programmer and I am sure that I can write a proper SQL that groups and sums the data and generate the result. And I can write a Java program too, that does the job, but I really want to do this calculation from Excel.
Is there any way to generate the report by using only a combination of existing MS Excel formulas without writing any Visual Basic code (macro)?
If yes, then could you please put me in the right direction and tell me which formulas I can use? Then I can figure out how to use the formulas.
I hope that this helps to understand better what I would like to have:
Try:
Formula in F3:
=SUM(COUNTIFS(C:C,E3,A:A,"<="&SEQUENCE(H$2-F$2,,F$2),B:B,">="&SEQUENCE(H$2-F$2,,F$2)))
Note that range references that take whole columns will take long to process all data. The above will work even with overlapping dates.

EXCEL: How to automatically add serial number in Excel Table using formula that is immune to filtering / sorting?

I want to create an Excel Table where the first column is the "SL" (serial number) column that starts from 1 and then increases by 1 for each subsequent entry. I want the serial number to automatically increase as I add more rows to the table.
I have tried using all manners of "=ROWS" functions, all manners of "=COUNTA" functions, and all other functions used in tutorial that I found in the web. None of them are immune from sorting or filtering. That is, if I sort the "Name" column from A to Z, the serial number that was assigned to its respective row entry changes because of how these formulae are written. For example:
This is the Original List. As you can see, Dragon Fruit's serial number is 1. I have used the "=COUNTA(B$2:[#[NAME]])" function in this example.
As you can see, when I sorted the "Name" column from A to Z, Dragon Fruit's serial number went from 1 to 2, Acai went from 4 to 1, Guava went from 9 to 3, and so on. But I want the serial numbers to be static and locked to their corresponding "Name".
Is this possible to do in Excel without manually typing the numbers in the SL column?
Good question and a tricky situation to deal with. I'm not sure if the question is better suited for SuperUser though.
The trick here is to somehow use absolute cell-references instead of relative ones. As you have now experienced, Excel filters won't work well with relative references. However, manually adding absolute references is not what we want to do.
To mimic the absolute cell-reference behaviour you can preceed the row reference with a sheet-reference which magically should counter the normal formula-behaviour and turn them into actual absolute cell-references:
Formula in A2 (which will auto-fill the 'SL' column):
=ROW(Sheet1!A1)
Data when filtered A-Z on 'Name':
Data when tabbed a new row:
You could use PowerQuery in Excel to add an index in front.
Remove the ID from your source.
Make your source a table
Import into PowerQuery and add an index
Load the output to another sheet. In this sheet you can filter and sort and everything you want.

Excel: Inconsistent sorting criteria from 'Smallest to Largest' to 'A-Z'

Situation:
I am pulling information from a database and exporting it into an Excel 2010 template. The data consists of unique IDs (numeric), dates, and text in their respective columns. When going to sort, Excel usually recognizes the unique IDs as text and gives me the option of 'A-Z' which yields the correct result.
Problem:
Occasionally when sorting the unique IDs, Excel will give me the option to sort from 'Smallest to Largest' and when this happens the report yields a wildly incorrect result.
Pattern:
The sorting criteria is the only common denominator when a report fails, which makes little sense as they are both ascending orders. This issue only occurs ~20% of the time. The other times it sorts correctly from 'A-Z' as it does in the other worksheets within the same template.
-I've tried changing Number Format within the drop down to 'Text' 'General' and 'Numbers'
-I've tried manually sorting the data through filters as opposed to sort hierarchies
-I've tried clearing the table, and re-copying/pasting the data into the template's worksheet. This seems to work, but as the end goal is automation, I'd like to find out what the root cause is.
Expected result: Numeric data copied and pasted into the field to be sorted from 'A-Z', resulting in a successful report.
Actual result: Numeric data copied and pasted into the field typically results in the sort option of "A-Z', but occasionally sorts from 'Smallest to Largest' resulting in a failed report.
Excel is designed for numbers - and is generally very helpful in coercing text to numbers where appropriate. However, once in Number format the reverse is not easy. As you have discovered, merely choosing Text as format is not enough.
A clue is whether or not (assuming activated) the cells show green triangles.
Other than starting afresh with data entry into a cell already formatted as Text, the conventional solution for conversion with code is to prepend a quote, though appending a space would also serve.
Other than that, the easiest mass conversion approach may be to copy into Word (Keep text only) and copy back to Excel with pasting as Text.
The better solution may be to store IDs as text and prepend 0s to a standard length.

Sort AlphaNumeric with structured references in Excel

I Have an Excel Sheet with data that looks like that.
Data
x=1.1
x=11.2
x=10.3
x=1.4
x=2.5;2.6
x=2.1
x=4.7
x=6.8
x=6.2;6.3
x=1.10
What i want to do is, to sort the List that it Looks like that.
DataSort
x=1.1
x=1.4
x=1.10
x=2.1
x=2.5;2.6
x=4.7
x=6.2;6.3
x=6.8
x=10.3
x=11.2
I tried to do that with that Formula
=LEFT(Tabelle1[[#this row];[Data]];2) & TEXT(SUBSTITUTE(Tabelle1[[#this row];[Data]];LEFT(Tabelle1[[#this row];[Data]];2);"");"#0.0#")
But that did not work.
Can someone give me a hint to the right Direction?
Copy the data into a new column say B
If you are using excel 2007 or higher, go to data tab --> text to columns option after selecting your data in B
Here you can choose delimited and it will separate your data into 2 columns.
Then apply the sorting based on this column
In an unused column to the right, use this formula starting in row 2,
=LEFT(A2, 2)&TEXT(--MID(A2, 3, FIND(".", A2&".")-3), "000;#")&TEXT(--MID(A2, FIND(".", A2&".")+1, 99), "000;#")
Fill down as necessary then sort conventionally using the helper column as the primary sort key.
        
If you put a 0 prior to the numbers, that would take care of it.
X=01.1
Or, in a convoluted way, split the column as recommended above, sort the way you want and then reassemble. I would also create a column with the right 1-n sequence, just in case I need to sort in a particular way, but the come back to the original sort.
The Solution to the Problem is:
=LEFT(IF(ISNUMBER(SEARCH(";";A1));LEFT(A1;FIND(";";A1;1)-1);A1);2)&TEXT(--MID(IF(ISNUMBER(SEARCH(";";A1));LEFT(A1;FIND(";";A1;1)-1);A1);3;FIND(".";IF(ISNUMBER(SEARCH(";";A1));LEFT(A1;FIND(";";A1;1)-1);A1)&".")-3);"000;#") &TEXT(--MID(IF(ISNUMBER(SEARCH(";";A1));LEFT(A1;FIND(";";A1;1)-1);A1);FIND(".";IF(ISNUMBER(SEARCH(";";A1));LEFT(A1;FIND(";";A1;1)-1);A1)&".")+1;99);"000;#")

Resources