This seems to be so simple of a request, but I was not able to find an answer. I have a numeric cell and it seems to round numbers. Can I ask excel to tell me formatting settings of a particular cell. For example if the number formatting is fraction up to one digit I would like to know that. It would also be nice to know what the other attributes are; like width, centering, and so on.
You can get some information using the cell function (doc), but it's not as useful as one hopes...
You need to use VBA for more details.
Related
How do I put a formula in a Custom Number Format in Excel? For example (random example for illustration purposes),
Assume I have the following data:
INPUT
OUTPUT
Without editing the actual data in the cells, I would like to display the value in the cell divided by 2, and with two decimal places:
Is there a way to do this directly in the Custom Number Format, i.e. Without adding helper columns/cells doing the division calculation. NB. the part that has me stumped is doing the division calculation in the Number Format
Thanks!
The answer is NO, if you want to do it through custom format in a cell directly.
However, there is workaround in pivot table using calculated field option as shown below:
By the way I am curious why you want to show the number in a value other than its true value in a cell? This is not a good practice which could lead to misuse of the data in my humble opinion.
I have been wanting to display my min/60 as minutes, but the decimal is necessary for calculations. The best way I've found so far is to use conditional formatting in fractions.
0/60 "min" would display. 21666666 as 13/60 min
Which is what the cell formula was. It's only useful for around an hours worth of time, but if I come up with something to more clearly display a calculation of such as 8.5hrs as 8hrs 30min I'll update.
READ CAREFULLY THE QUESTION PLEASE, IT MENTIONS EXCEL VBA.
NOT EXCEL
I was given the task of fixing a date input on a VBA form. A textbox should have the user enter the date as MM/DD/YYYY.
I am required to use an input mask, not allowed to do something as validating date after or using a calendar. So far I was able to use the 2 methods mentioned (forcing the format after using ISDATE).
However, it has now been made clear it has to be a mask so keys are filtered on entry, with the mask being visible when entering the date: __/__/____
Where you see underscore, he should only be able to enter numbers and the / are always at those positions
Is there a way to do this? I can only find a tutorial for the mask in Access VBA.
I Googled "Excel input mask" and the 2nd result was: Using an Input Mask Microsoft Excel written by Allen Wyatt...
Using an Input Mask
...You may wonder if there is a way to set up an input mask that will add the colon automatically. The good news is yes, there is. The bad news is no, there isn't. Sound confusing? Let me explain...
You can set up a custom format that will display your time in any format you want. For instance, you could use the following steps:
Select the cells you want to use for time input.
Choose Format from the Cells menu. Excel displays the Format Cells dialog box.
Make sure the Number tab is displayed.
In the Category list, choose Custom.
Replace whatever is in the Type box with #":"00.
Click on OK.
You can now enter your times using just digits. The problem (and this is the bad news) is that the cell doesn't really contain a time. If you enter 230 (for 2:30), it doesn't contain 2:30 as a timeāit contains two hundred and thirty. Thus, you can't use the contents of the cell directly in time calculations.
To overcome this, you can use another column to show the entered digits converted into a time. All you need to do is use a formula to do the conversions. For instance, if the time you entered was in cell A3, you could use the following formula in a different cell to do the conversion:
=(INT(A3/100)/24)+((A3 - (INT(A3/100)*100))/1440)
Format the cell that contains the above formula so it displays one of the various time formats, and you are all set.
(Full article and more at the source.)
This post may help you...
Formatting MM/DD/YYYY dates in textbox in VBA
I've tried searching for a solution to this problem, but all google results are fairly fruitless, at least with my search terms.
Is there some option/IDE/page that will automatically format a multi function excel formula to a more human readable layout? Either in Excel or outside?
Currently I have a several =if(and(if(and())if(and()))) statements that gumm up the legibility and was wondering if there is a solution for this.
The formula is as follows:
=IF(AND(IFERROR(INDEX(INDIRECT("Truck"&A72),5,5),"")<>"-",IFERROR(INDEX(INDIRECT("Truck"&A72),5,5),"")>0,INDEX(INDIRECT("Truck"&A72),4,1)="rig"),IFERROR(INDEX(INDIRECT("Truck"&A72),4,3),"")&" - "&IFERROR(INDEX(INDIRECT("Truck"&A72),3,3),""),IF(AND(IFERROR(INDEX(INDIRECT("Truck"&A72),5,5),"")="",INDEX(INDIRECT("Truck"&A72),4,1)="rig"),"",IF(AND(INDEX(INDIRECT("Truck"&A72),4,1)="pickup",IFERROR(INDEX(INDIRECT("Truck"&A72),6,3),"")<>"-"),IFERROR(INDEX(INDIRECT("Truck"&A72),6,3),""),IF(AND(INDEX(INDIRECT("Truck"&A72),4,1)="pickup",IFERROR(INDEX(INDIRECT("Truck"&A72),5,5),"")="-"),"",IF(1=1,IFERROR(INDEX(INDIRECT("Truck"&A72),4,3),"")&" - "&IFERROR(INDEX(INDIRECT("Truck"&A72),3,3),""),IFERROR(INDEX(INDIRECT("Truck"&A72),4,3),"")&" - "&IFERROR(INDEX(INDIRECT("Truck"&A72),3,3),""))))))
Looking at this it may be easier to refractor into VBA then continue along this path of If-Ands. But I don't anticipate many more, if any, conditions.
The gist is: The formula looks at cells to see if value has been applied to them, and will return the desired cells information based on that. Basically If a truck is a 'rig' and has weight, the Customer and Name will be returned, otherwise blanks are returned.
This particular formula is gathering information for a printable document that I can give to my loading crews in the evening, so they can pack it for delivery tomorrow. Im trying to automate my Job a bit. Because otherwise its all paper and pen here.
Thank you.
I took your ?beautiful? formula an entered it into a cell. Then I clicked in the formula bar and positioned the cursor before some of the IFERROR's. I then touched Alt + Enter. I then increased the width of the formula bar.
This does not affect the functionality of the formula, but does affect the formatting in the formula bar:
I'm pretty new to Excel, and one of my bosses (who knows even less about Excel than I) is asking me to create a spreadsheet that will track a bunch of different deadlines. For quick reference, I need to use conditional formatting to do the following:
Highlight only non-blank cells that contain a date in the past.
Highlight with a color scale cells containing dates between now and now+90 workdays.
Nothing I've tried is giving me the results I need. I'd appreciate any guidance, as I'm getting very frustrated and this is fairly time-sensitive.
I will answer your second question. I think you will be able to answer the first one yourself from what you learn from the second one.
The executive summary is: use a combination of TODAY() and WORKDAY().
Now for some useful detail.
First, I suspect (from your reputation) that you are new to StackOverflow. Welcome! Take a look on the right side of this page. At the bottom there are "Related" questions. I obtained the following one from there. It is half of the answer to your question. The key point is to use the TODAY() function in your formula.
Second, the WORKDAY() function, with a positive number n, provides a date n workdays into the future. You may also need to make adjustments if your company's calendar is different from the canonical one.
You may want to set a cell in your spreadsheet to the date returned by =WORKDAY(TODAY(),90). Lets just pick A1 for simplicity of explanation. When you first add that formula, you will get what seems like a nonsensical number. Change that cell's format to date and it will make sense.
Now you can refer to A1 in your conditional formatting, as in the "less than" highlighting rule. That should do it.
P.S., while you are at it, search for "named ranges". As a beginner, it is probably the most useful "trick" you could learn. Then name whatever your A1 cell turns out to be something meaningful, like ninetyWorkdaysAhead (you cannot start a named range with a number), then refer to that name in your rule. That way, if you need to move it, your code will not break.
When numbers are stored as text in Excel you see this little guy http://imgur.com/zXdwD
in the upper-left hand corner. when you click on it it gives you the option of converting the text representation of a number to a number upon which math can be done. also, when stored as text numbers appear on the left side of the cell opposed to the right one. I have an array of numbers which are stored as text, but they don't offer that little green thing to convert them to numbers. It may sound trivial but I'm using the Vlookup function to reference a large column of numbers to a code name, but it's not being recognized. And the only thing I can think of is that it's somehow being read differently (the codes are most defintely in the lookup table, and ctrl+f will find them). I want to know if anyone has an idea about what's happening.
Thanks.
The smart tag is a little finicky at times. There's a couple of things you can do.
If you're using code, you can multiply the cells in the range by 1, this will convert them to a number.
Alternatively you can convert the number you're matching to a string and then vlookup. Something similar to:
=VLOOKUP(TEXT(A1,"#"),B1:D10,2,false)
Note TEXT(A1,"#") would round to no decimal places, you may have to adjust the formatting.
The format of some of the cells in the lookup table maybe formatted as text. If there are a lot of them you can create a macro that corrects them. I had the same issue in this SO question although it was the opposite problem.
Another way to correct them would be to copy all the cells in the lookup table in that column and in an adjacent blank column edit>paste special>values>add which makes each of them numeric. Then copy them and paste those back over the originating cells.
A quick trick to convert all numbers formatted as text back to umber format is to copy the data into the "Notepad" application. Then select and copy the data from "Notepad back into your spread sheet and everything will be converted to number format.