A little tricky to explain, but basically, my cells are formatted as shortened dollar values with "K", "M", "B". So for example, $1,500,000 is shown as $1.5M, or $830,000 as $830.0K.
Now I want to copy the exact format of that cell "literally", meaning that I will not be copying just the formatting, but rather "treat" the cell as is.
Example:
B2 = 1500000 (in formula bar)
Formatting: Custom| [>=1000000000]$#,##0.0,,," B";[>=1000000]$#0.0,," M";$#0.0," K"
Shown in the cell as: $1.5M
Once I do the "literal" copy to C2, it should look like this:
C2 = $1.5M (in formula bar)
Formatting: General
Show in the cell as : $1.5M
The reason - I'm doing a previous month comparison and will need to add a character after the cell that will be used as a "symbol" in InDesign, specifically Wingdings 3 with "p" & "q" as Up/Down arrows. I have a simple If statement that compares last month's data, and simply adds the character in:
=if(B2>D2, C2 & "p", C2 & "q") (let's treat that C2 is the formatted $1.5M)
But using that formula, it removes the formatting entirely and so, the shortened format is gone. It will only show the value as "1500000 p", when the "desired output should be "$1.5M p". And you can't really apply any more formatting after that, since adding a character means that Excel now treats the value as Text, and not a number that can easily be formatted.
Is there a way to have the best of both worlds, having both the shortened dollar values and have a character at the end when doing comparisons? If
I'd rather stay away from VBA, but if it's the only way to do so, then might as well use it instead of not having anything at all.
Agree with BigBen's comment. I think Text is the only way non VBA.
Maybe a helper column with this formula?
=IF(A1>=1000000000,TEXT(A1,"$#0.0,,,")&" B",IF(A1>=1000000,TEXT(A1,"$#0.0,,")&" M",TEXT(A1,"$#0.0,")&" K"))
Related
I want to make an excel formula so that, I can test out 3 columns and if they are true then to set a new value to the 4rth column.
I have this formula:
=IF(AND(A1="ALFA ROMEO"; B1="159"; C1="55");D1="2016";D1="")
and I want to check if A1 and B1 and C1 are true then to set D1 equal to a certain value.
*I've tried many complex ways to achieve it but this formula is the only one that doesnt pop up an error, but still gives back the Value FALSE(Not in D1, but in the cell I tried it). I've also tried seperating with commas etc...
Any possible help or way I could achieve the check?
It should come from the quote ("") around the number
I've try this
=SI(ET(A1="ALFA ROMEO";B1=159;C1=55);2016;"")
and it worked for me (sorry it's in french).
Maybe try to change cell format from the column B and C.
And also put the formula in cell D1 or in the cell you want the value.
You're almost there, but you need to put this formula here in cell D1 in order to fill the value of D1:
=IF(AND(A1="ALFA ROMEO", B1=159, C1=55),2016,"")
Keep out: in my locale I'm working with commas, while you might be working with semicolons, so your actual formula might be (in cell D1):
=IF(AND(A1="ALFA ROMEO"; B1=159; C1=55);2016;"")
Also, no need to put numerical values (159, 55) as strings, as you can see.
Edit: about turning B1 into a string:
I've just created this formula:
=IF(TEXT(B1,"0")="159","TRUE","FALSE")
This allows you to convert B1 into text.
So, your formula might turn into something like:
=IF(AND(A1="ALFA ROMEO", TEXT(B1, "0")="159", TEXT(C1,"0")="55"),2016,"")
(Again, mind the locale settings (commas and semicolons))
Is there any way to use cells of excel in my mathematical equations? I'd like a way to just change the numbers and the equations automaticlly update with them. I tried concatenating strings but it's not that pretty. Or maybe is there any other way to easily show equations step by step in excel?
You say that concatenation of strings is not that pretty, so I assume you have done something like:
in cell A1 : "Hello"
in cell A2 : "World"
in cell A3 : =A1&A2
And in cell A3, you see "HelloWorld", without any space (which is indeed not pretty).
You can solve this in two ways in A3:
=A1&" "&A2
=TEXTJOIN(A1:A2, " ")
(I'm not entirely sure about the syntax of the second one.)
In the first formula, you concatenate both cells A1 and A2 and you specifically mention to put a space between those two.
In the second you do the same, but you mention that the space must be used everywhere.
The difference can be seen in following example:
In cell A1: "Hello"
In cell A2: "Lovely"
In cell A3: "World"
In cell A4, you can put: =A1&" "&A2&" "&A" for getting "Hello Lovely World": you need to mention the space character twice.
In cell A4, you can put: =TEXTJOIN(A1:A3, " ") for getting the same result. As you see you only need to mention the space character once.
Is this what you are looking for?
I have a scenario where I want my Microsoft excel field to have the same length of the longest word in the column.
Basically lets say if I have:
ACBBASDBBADSAD
BADFDFDDF
So here I want to have the second word with less characters to have white spaces at its end to match the length of the first word.
=&" " this definitely helps but I am unable to achieve the above scenario
Consider this screenshot:
In column B the length of each cell of column A is established with the formula =len(A1) copied down.
Cell D2 has the range name MaximumLength and the formula =max(B:B).
With that in place, you can create the padded values with this formula in cell G1, copied down:
=A1&REPT("*",MaximumLength-LEN(A1))
If you don't want to use the helper column and helper cell, you can use this array formula instead:
=A2&REPT("*",MAX(LEN(A1:A15))-LEN(A2))
This formula must be confirmed with Ctrl-Shift-Enter. It is advisable to use defined ranges, not whole columns in array formulas, hence the range in LEN(A1:A15). Adjust as desired.
I've used the "*" character so it is visible. Replace it with a space " " in your scenario.
You can add this formula to count maximum characters and use on some cell, because you will need to press a command for it to work, so every cell can't contain this formula, let's say it is on Z1:
=MAX(LEN($A:$A))
Certify to press ctrl+shift+enter on the formula
Then you use this formula on your cells:=REPT(" ";Z1-LEN(A2))&A2
Edit: Sorry, anwsered late, teylyn is more complete.
Hi, I'm trying to input a function in C2 in order to assign a numerical value to the minutes given in Column B. The criteria for this can be seen in the image above (starting at G1).
I have tried using a formula I copied from a similar situation but is not working:
=IF(B2<=$A$2,5,IF(B2<=$A$3,4,IF(B2<=$A$4,3,IF(B2<=$A$5,2,1))))
Any help would be appreciated, thanks
The suggestion by #Jeeped above will simplify the formulas needed. If you have to keep the 'A' and 'B' cells as they are listed above, you have to extract the number from the 'x min' format and convert the 'x' to a number so it can be compared (I assume a " " exists after the number. Could search for " min" as well).
=VALUE(LEFT(A2,SEARCH(" ",A2)-1))
Using the above, if A2 = '60 min', the formula will produce a '60'.
Now that the cell contents can be treated as numbers, the comparisons can be made. Formula for C2:
=IF(VALUE(LEFT(B2,SEARCH(" ",B2)-1))<=VALUE(LEFT($A$2,SEARCH(" ",$A$2)-1)),5,
IF(VALUE(LEFT(B2,SEARCH(" ",B2)-1))<=VALUE(LEFT($A$3,SEARCH(" ",$A$3)-1)),4,
IF(VALUE(LEFT(B2,SEARCH(" ",B2)-1))<=VALUE(LEFT($A$4,SEARCH(" ",$A$4)-1)),3,
IF(VALUE(LEFT(B2,SEARCH(" ",B2)-1))<=VALUE(LEFT($A$5,SEARCH(" ",$A$5)-1)),2,1))))
This is ugly, but works given the original question.
Try this formula (in this case for C2):
=SUM((B2<=$A$2:$A$5)*1)+1
It is important to use it as array formula. So after typing or inserting this formula to your cell don't just commit with Return but hit Ctrl+Shift+Return. If you did it right, your formula will be surrounded by curly brackets in formula bar:
{=SUM((B2<=$A$2:$A$5)*1)+1}
I want make a formula which includes text and the output will be a different text also.
Like:
G8 = I am Red,
G9 = I am Green,
G10 = I am White.
Now, I need a formula which will give output like:
"Red" (in H8 field) when I enter "I am Red" and so on for other inputs.
I have tried with 'nested if', but only 7 nested if can be added, whereas I have at least 40+ values to input and need to get different output for those input.
Assuming your data is in column G starting G8, do the following:
Type in H8: =RIGHT(G8,LEN(G8)-MAX(IF(MID(G8,ROW(INDIRECT("1:"&LEN(G8))),1)=" ",ROW(INDIRECT("1:"&LEN(G8))),0))).
Press CTRL+SHIFT+ENTER instead of usual ENTER - this will define an ARRAY formula and will result in {} brackets around it (but do NOT type them manually!).
Autofill formula down your range.
It will return the last "word" in a string, or more exactly - part of string between the last space and its end, regardless of actual symbols.
Sample file: https://www.dropbox.com/s/dfkk1cqy1z0o3pz/ColorName.xlsx
A vlookup may work here. You would enter all data combinations, and then use vlookup, based on the "I am red" column, which would find the corresponding value in the table and return it. Depending on the type of data, you may have better success with the index and match method instead of vlookup.