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?
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))
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"))
I was wondering if there is a way to make a formula than uses a cell n times, for example:
=concatenate(A1,", ","some string")
=concatenate(A1,", ","some string")
=concatenate(A2,", ","some string")
=concatenate(A2,", ","some string")
and so on.
Here what I want to show is that cell A1 is repeated 2 times, then A2 two times as well, etc.
How can I achieve that with just drag the cells down.
And also I need to achieve this:
A B C
one dog one dog
two cat one cat
three two dog
four two cat
three dog
three cat
in this case, I want to concatenate the values from column B, thats why I need to repeat it two times
You can use an Index function to identify which cell to concatenate. For a regular pattern of using every row twice, use
=CONCATENATE(INDEX(A:A,ROUNDUP(ROW()/2,0)),", ","some string")
Copy down.
Please try:
=INDIRECT("A"&(MOD(ROW(),2)+ROW())/2)&", some string"
A version for repetition three times:
=INDIRECT("A"&FLOOR(1+(ROW()-1)/3,1))&", some string"
or for repetition two times with alternating strings from B1:B2 :
=INDIRECT("A"&(MOD(ROW(),2)+ROW())/2)&" "&IF(ISODD(ROW()),B$1,B$2)
Once the formulae have achieved the appropriate expansion they should be selected, Copy, Paste Special, Values over the top to replace the formulae with the results of the formulae.
Not that I know of without using VBA, but you could change the formula (assuming those formulas start in cell b1) to:
=concatenate(indirect(A1),", ","some string")
and then in cell A1 you'd type in whatever cell you wanted to reference, so in cell A1 you'd type in a1 and then in cell A2 you'd type in a1 again.
I'm trying to extract a word from a sentence if it starts with one of the following letters.Dell** or Samsung** or Apple**. The position of the words may vary in the cell.
A1: Dell2622 Retail34792 Lenovo StoreQuantity4
A2: Retail9858 Qty8 Samsung783546 Android
A3: Retail21512 Apple3411 StoreQty15 Macintosh
I am trying to use the following formula to extract the Dell** or Samsung** or Apple** if it's present int the cell.
=MID(A1, SEARCH({"Dell","Samsung","Apple"},A1), SEARCH(" ",A1, SEARCH({"Dell","Samsung","Apple"},A1))- SEARCH({"Dell","Samsung","Apple"},A1))
It works for the cell A1, but everything else returns #VALUE!. I guess it doesn't recognize that i want it to check for either or and extract either or. The result I'm trying to achieve is:
A1: Dell2622
A2: Samsung783546
A3: Apple3411
Later on i may need to add more things to search for, so I'm trying to keep it easily modifiable. I guess since it finds the first instance, then it's just a matter of tweaking something to ensure that if it didn't find the first value it looks for second, etc.
Assuming you have a data setup similar to the picture below, with your strings in column A, the formula in column B, and the words to look for in column D:
The formula in cell B2 and copied down is:
=TRIM(LEFT(SUBSTITUTE(MID(A2,MIN(INDEX(SEARCH($D$2:$D$4,A2&$D$2:$D$4),)),255)," ",REPT(" ",255)),255))
And per your request to not use a range reference and instead have the list of words directly in the formula:
=TRIM(LEFT(SUBSTITUTE(MID(A3,MIN(INDEX(SEARCH({"Dell","Samsung","Apple"},A3&{"Dell","Samsung","Apple"}),)),255)," ",REPT(" ",255)),255))
How can I extract the first word of a number of different cells and have each of the first words show together in one other cell separated by comma?
e.g. A1 shows "Firstname1 Lastname1", A2 shows "Firstname2 Lastname2", A3 shows "Firstname3 Lastname3",
I need a formula allowing me to show the following in cell D2 "Firstname1, Firstname2, Firstname3"
I found this solution, which gives me the first word of one cell and shows it in another cell but I don't know how to get the first word of a number of cells and show them all coma separated in another cell
=LEFT(A1,SEARCH(" ",A1)-1)
Excel function to get first word from sentence in other cell
Thanks!
What if instead of just three cells you have an Excel range A1:A100 which has all the names? How would you concatenate in such an instance? Will you type that long a formula?
As Jerry suggested, VBA is Apt for this. But what if you do not want to use VBA or long formulas?
See this example. I am taking 10 cells for the sake of explaining.
Let's say the data looks like this.
Now select the entire column and click on Data~~>Text To Columns
When you click finish, the output will be like this
Now in cell say E4, type this =Transpose(A1:A10). Replace A1:A10 with the actual range. However do not press the Enter key. Press the key F9. You will see that all the first names are now visible.
Simply copy that and press Esc. Now open Notepad and paste it there.
Next delete the { and the }
Next manually replace "," by , and you will get what you wanted.
=LEFT(A1,SEARCH(" ",A1)-1) &", "&LEFT(A2,SEARCH(" ",A2)-1)&", "&LEFT(A3,SEARCH(" ",A3)-1)
using your current formula, =LEFT(A1,SEARCH(" ",A1)-1), you can add the value of subsequent cells to the previous calculation, and build the comma separated values.
in B1, we have your original formula, =LEFT(A1,SEARCH(" ",A1)-1)
in B2 we concatenate the previous result, and add on the comma and the new word:
=B1 & "," & LEFT(A2,SEARCH(" ",A2)-1)
copy this to B3 (and on) and you will slowly see the full list getting created.
The last value is the one you want, so, in C1, put the formula
=OFFSET(B1,COUNTA(B:B)-1,0)
(and hide column B so it looks better)