I have a program that creates a table, adds it to a flow document along with table cells that are populated with text. Everything works great with one exception. One column of cells in the table displays costs and they have been formated as follows:
cellValue = "$" + string.Format("{0:##,#.00}", int.Parse(cellValue)).PadLeft(22 -
cellValue.Length);
As it turns out, with this formatting numbers like $ 11,111 take up a different width then numbers like $ 10,000. I would guess because the font is not equal width for each character.
What I would like to do is be able to display the costs just like the are when in an Excel spreadsheet when formatted as Accounting (ie the dollar sign is left hand justified, the numbers are right hand justified and the numbers are lined up from cell to cell).
Example:
$ 10,000.00
$ 11,111.11
If someone knows what formatting to apply to reach this goal please let me know.
This is probably too simple but at a guess I would use fixed font for the cell like "Courier New" so that all the characters are the same width and would align up. The downside of this is that "Courier New" is not the most elegant font to use.
I am sure Excel uses a much more sophisticated mechanism for aligning numeric values.
Maybe you should use something that better mimics a spreadsheet than a table in a flowdocument.
Related
I have a dataset where I calculate one-hot encoded labels for the hugging face trainer. However I have to drop some labels before training, but I don't know which ones exactly. So the resulting label space looks something like this:
{[1,0,0,0], [0,0,1,0], [0,0,0,1]}
Note how [0,1,0,0] is not in the list.
Now, when evaluating the model, it returns an array of probabilities.
Assuming I have hundreds of labels and don't know which ones have been dropped, how do I map the trainer's output (e.g. after softmax) to the correct labels?
I have a roster table for a sports facility that has been formatted and has a column of merged cells (for human readability). Unfortunately I cannot change the formatting to eliminate the merged cells - too many people use it and in any case I'd need to overhaul all the formulas everywhere.
The cells contain names and merge 4 rows of a single column.
Formatted roster table w/ sample data
In a separate range I am trying to take this formatted info and put it into 1st normal form for analysis & graphing purposes. Since merged cells only contain the top-leftmost value, when trying to copy the column contents by formula (e.g. "=B14") it only shows the name in the top cell followed by 3 empty ones below.
I need to fill in the blank rows by copying the athlete names down. The other column formulas are working just fine.
For the life of me I can't figure it out. It has to be a formula and not apps script due to mobile use, and I've always been really bad with certain formulas and good with others. Usually I can make a guess at it, but this time I'm just lost.
Can someone point me in the right direction?
use:
=ARRAYFORMULA(IF(B2:B="",, VLOOKUP(ROW(A2:A), IF(A2:A<>"", {ROW(A2:A), A2:A}), 2, 1)))
I am building a calculator that detects streamflows that falls below a certain flow rate. I have an array formula that takes a column of data, and identifies how many data points in a row fall below a particular threshold (threshold value in C12):
{=MAX(FREQUENCY(IF(E23:E12275<C12,ROW(E23:E12275)),IF(1-(E23:E12275<C12),ROW(E23:E12275))))}
This formula works, but I want to be able to build in the ability to detect the last row with entered data. In this example, the data set finishes at E12275, but datasets can extend many more rows. If I extend the formula to this:
{=MAX(FREQUENCY(IF(E23:E1000000<C12,ROW(E23:E1000000)),IF(1-(E23:E1000000<C12),ROW(E23:E1000000))))}
the formula interprets the blank cells (after the last full cell) as zero, and says that they fall below the threshold. This gives me a result of 987725 (1000000-12275)
I have built another formula that detects the bottom row cell address:
=ADDRESS(LOOKUP(2,1/(E23:E1000000<>""),ROW(E23:E1000000)),5,1)
However I am having trouble incorporating this result into the existing formula. Does anyone have any thoughts on how to do this?
NB: I have also toyed with the idea of building a formula that excludes blank cells, however the actual datasets include blank cells, which should be interpreted as "below threshold"
I've got a bigger table with one column that I want to focus on, containing designation and a number. I want to simply sum the numbers that meet the criteria based on a designation.
For the simplification, I made an exercising sheet (on the pic) where I split second column into two - one string and one numeric. Since my file is quite large with many columns that would need this it would be inconvenient.
In the left column it's easy to solve the problem, it could be even easier with simple SUMIF function, but an array SUM(IF... function is, at least I think, only viable option here.
So I solved the first table with array function, but what confuses me is how to modulate the TRUE statement. Simple replacement of C:C
with
VALUE(MID(F:F;4;4))
which would format my cells to get the numbers from string does not work that way - returns zero in E12 field. F12 is just application of string to number for last cell, F10.
THIS formula does not work, even adapting to different versions of the tool.
I could use VB but if possible anyhow I would like to avoid it since parts will be shared on mobile phones.
Any ideas? Thanks a lot!
Left table was split, right original format
The array formula which you used can be replaced by the SumIf formula like below...
=SUMIF(B:B,"B",C:C)
Also without the helper column, you can use the Sumproduct formula to achieve the desired output.
But don't refer the whole column in the formula like in the above SumIf formula.
Try this..
=SUMPRODUCT((B1:B10="B")*MID(F1:F10,FIND(",",F1:F10)+1,255)*1)
Change the ranges as per your requirement but remember to make them equal in size.
What I am trying to achieve is to see if the value of Cell C4 exists in Column F.
If it exists in Column F, I eventually want Cell A4 to copy the format of the cell in Column F that matches the value of Cell C4.
Still following me?
For reference, my file looks like this:
The values of the cells in Column A are based on Sheet2.
So with a simple formula I managed to compare the values and only change Column A when there is an actual match as seen below.
=IF(C4=F:F, IF(C4<>"","x",Sheet2!A4), Sheet2!A4)
The only problem here is that it only results in a TRUE statement, if Cell C4 matches Cell F4. If it matches, let's say Cell F5, the statement will be FALSE and I need it to be TRUE (since value of C4 is indeed found in Column F.
I tried a variation using $F:$F instead of F:F, but this made no difference. Also setting a range (F2:F5) did not work.
This is where I am stuck.
As soon as I have this figured out, I can continue finding a way of copying the format of the matched cell. Feel free to reveal how I manage to do this if you already know. Will save me some headaches.
Try the following:
=IF(IFERROR(MATCH(C4,F:F,0),0)>0,IF(C4<>"","x",Sheet2!A4), Sheet2!A4)
Edited formula error (; --> ,)
EDIT:
Ok, so forgetting about you formula and trying to do what I think you want, which is:
Be able to copy in the list of resolvers at work into your color code scheme, and then apply that format to all tickets where this person is responsible. There has to be a way of telling, based on color, whether a ticket is assigned to a person that is not on the job (not in the list), or is not assigned to anyone. I assume you have a very limited amount of people at work, because if not, it will be very difficult to distinguish between the colors.
Being quite few people at work at one time, what you could do is to:
Name your the range with people at work "workers"
Name the new range "colors"
For each row with a color coding, enter the name of the color, or some other way of referencing the color. I entered "Yellow" "Red", "Green", "Blue", and I added a black for "x".
Selected the top cell in the tickets column, selected new conditional formatting rule, entered the following formula
=IFERROR(INDEX(colors;MATCH($C1;workers;0));"x")="Yellow"
Selected that this should have yellow fill, and applied to the entire Tickets column.
Did the same for red, green, black, etc.
Doing this, I managed to get the following behaviour:
1. I can change the names in the name column, and conditional formatting will not change
If a ticket is solved by someone in the list, the background color of TicketX is the same as the name in the name list
If a ticket is not solved by anyone, the formula returns "", which is not in any of the conditional formatting rules, so it remains white
If a ticket is solved by someone not at work, formula evaluates to "x", which is tied to color black in conditional formatting, so the cell turns black (could consider adding white text here to be able to see ticket number).
Now this is not that pretty, because you have to create so many rules, but as I say, if you are to distinguish between the colors, there can't be too many of them anyway.
To answer the first question of seeing if C4 exists in column F, you can put the following formula in cell E4.
=IFERROR(INDEX($F$2:$F$5,MATCH(C4,$F$2:$F$5)),"")
It will put the name if it exists and have a blank field if it doesn't. Just drag this formula throughput column E (or whatever column you want).
In order to match formats and don't want to get into VBA (and assuming you don't have a lot of possibilities), you could add conditional formatting to the new column of E. With the "Classic" Style of conditional formatting, make a new rule that sets your custom format when the cell contains the specific text of "Henk". Then continue on making rules for the other possible options. After you create the conditional formatting in, say, cell E4 for example, change the "Applies to" field to apply to Sheet1!$C$2:$C$5.