I would like to know how to split a cell in Excel after the first space. Using Google I came across:
=LEFT(C2,FIND(" ",C2)-1) (Formula 1 In D2)
=RIGHT(C2,LEN(C2)-FIND(" ",C2)) (Formula 2 In E2)
And that should do exactly what I want and need but sadly Excel (Office 2013) just tells me that the code is supposed to have an error.
For example my Table looks like this : (// means new cell)
Value// Formula 1 // Formula 2
BRAND ID1 ID2 ID3// Formula 1// Formula 2
Short answer for a German Excel:
=LINKS(C2;FINDEN(" ";C2)-1)
=RECHTS(C2;LÄNGE(C2)-FINDEN(" ";C2))
Unfortunately, Excel behaves differently in different languages (Obviously the worst thing the developer of a programming language can do).
In detail, the following things are known to depend on the language:
Argument separator: English uses comma (,) where German and probably other languages use semicolon (;). The actual value is taken from the regional settings in windows (thx to Jeeped).
Error message in Excel: "The formula contains an error"
Function names: They are normally different for every supported language. You have to try their translation or lookup them. There are also translations tables in the www.
Error behaviour in Excel: The cell value shows: "#NAME!"
Related
A B
1 2020-01-01 2020-01-01 =TEXT(A1,"YYYY-MM-DD")
2
3
In my spreadsheet I have a date written in Cell A1 and change it to a TEXT format with the formula in Cell B1.
All this works fine as long as I use the English version of Excel.
Now, a coworker in Poland needs to use the file in a polish Excel version.
Once he opens the file the formula in Cell B1 changes to:
=TEKST(A2;"YYYY-MM-DD")
This formula gives back an error because in Poland instead of YYYY-MM-DD you need to use RRRR-MM-DD.
Therefore, I am wondering if it is somehow possible to make this text formatting international so no matter in which language your Excel is set up the formula is working?
If the only problem is sharing it with your Polish co-worker, then you can simply use the international placeholder "e" to replace "YYYY":
=TEXT(A1,"e-MM-DD")
Now, while this would work fine for your co-worker in Poland, there are countries where "m" and "d" would also need replacement. If in general we need to return the locale "Y", "M" or "D" equivalent you could create three named formulas using the name manager:
1st: Create name called YT and refer to =INDEX(GET.WORKSPACE(37),19)
2nd: Create name called MT and refer to =INDEX(GET.WORKSPACE(37),20)
3rd: Create name called DT and refer to =INDEX(GET.WORKSPACE(37),21)
Now you can use a reference to these names through:
=TEXT(A1,REPT(YT,4)&"-"&REPT(MT,2)&"-"&REPT(DT,2))
NOTE: Depending on which version of Excel you use it could be necessary to:
Enable Excel 4.0 macros when VBA macros are enabled in the Trust Center
Another option with no macros is to use FORMULATEXT:
In a random cell Z5
=TEXT(123, "foo")
Then in your desired cell C1
=TEXT(A1,IF(ISERROR(SEARCH("TEKST", FORMULATEXT(Z5)), "YYYY", "RRRR") & "-MM-DD")
This works because the formula of the random cell will be updated to say TEKST in polish and you can just spot that happening. Obviously the other method is more robust to any country but this requires no settings to be changed.
Bigger:
=TEXT(
A1,
IF(
ISERROR(
SEARCH(
"TEKST",
FORMULATEXT(Z5)
),
"YYYY",
"RRRR"
) & "-MM-DD"
)
The solution is actually simple, surprisingly so.
Whether specifying a formal Custom Format, or specifying a format inside a TEXT() (or TEKST() function), you just add the country-specific code for interpreting the formatting string. So, if a US-Excel version person is writing the formula, and is presumably most conversant in the US English strings to use, and especially if expecting the users to be US-Excel version users, he would write it as:
=TEXT(A1,"[$-en-US]YYYY-MM-DD")
Every version of Excel will then use the US English set of formatting string variables in interpreting the formatting string that follows the [$-en-US]. Since the string is perfectly valid in US English Excel, it will form the date properly and "textify" it as demanded. No error will be produced.
I cannot test a nuance here, that of whether Excel of a different language version will insert itself into the middle here and take the date as the string formats it, and map it to the particular language's names for months, but that is not asked for in the poster's question so... I have the feeling it will not and so one might need to do further work to make the Polish user happiest. If month names were used instead of month numbers.
But the key element of generating a correct numeric date display with no possibility — none at all — of an #ERROR! result rendering things ugly and useless will absolutely be accomplished with no great effort at all.
A B
1 2020-01-01 2020-01-01 =TEXT(A1,"YYYY-MM-DD")
2
3
In my spreadsheet I have a date written in Cell A1 and change it to a TEXT format with the formula in Cell B1.
All this works fine as long as I use the English version of Excel.
Now, a coworker in Poland needs to use the file in a polish Excel version.
Once he opens the file the formula in Cell B1 changes to:
=TEKST(A2;"YYYY-MM-DD")
This formula gives back an error because in Poland instead of YYYY-MM-DD you need to use RRRR-MM-DD.
Therefore, I am wondering if it is somehow possible to make this text formatting international so no matter in which language your Excel is set up the formula is working?
If the only problem is sharing it with your Polish co-worker, then you can simply use the international placeholder "e" to replace "YYYY":
=TEXT(A1,"e-MM-DD")
Now, while this would work fine for your co-worker in Poland, there are countries where "m" and "d" would also need replacement. If in general we need to return the locale "Y", "M" or "D" equivalent you could create three named formulas using the name manager:
1st: Create name called YT and refer to =INDEX(GET.WORKSPACE(37),19)
2nd: Create name called MT and refer to =INDEX(GET.WORKSPACE(37),20)
3rd: Create name called DT and refer to =INDEX(GET.WORKSPACE(37),21)
Now you can use a reference to these names through:
=TEXT(A1,REPT(YT,4)&"-"&REPT(MT,2)&"-"&REPT(DT,2))
NOTE: Depending on which version of Excel you use it could be necessary to:
Enable Excel 4.0 macros when VBA macros are enabled in the Trust Center
Another option with no macros is to use FORMULATEXT:
In a random cell Z5
=TEXT(123, "foo")
Then in your desired cell C1
=TEXT(A1,IF(ISERROR(SEARCH("TEKST", FORMULATEXT(Z5)), "YYYY", "RRRR") & "-MM-DD")
This works because the formula of the random cell will be updated to say TEKST in polish and you can just spot that happening. Obviously the other method is more robust to any country but this requires no settings to be changed.
Bigger:
=TEXT(
A1,
IF(
ISERROR(
SEARCH(
"TEKST",
FORMULATEXT(Z5)
),
"YYYY",
"RRRR"
) & "-MM-DD"
)
The solution is actually simple, surprisingly so.
Whether specifying a formal Custom Format, or specifying a format inside a TEXT() (or TEKST() function), you just add the country-specific code for interpreting the formatting string. So, if a US-Excel version person is writing the formula, and is presumably most conversant in the US English strings to use, and especially if expecting the users to be US-Excel version users, he would write it as:
=TEXT(A1,"[$-en-US]YYYY-MM-DD")
Every version of Excel will then use the US English set of formatting string variables in interpreting the formatting string that follows the [$-en-US]. Since the string is perfectly valid in US English Excel, it will form the date properly and "textify" it as demanded. No error will be produced.
I cannot test a nuance here, that of whether Excel of a different language version will insert itself into the middle here and take the date as the string formats it, and map it to the particular language's names for months, but that is not asked for in the poster's question so... I have the feeling it will not and so one might need to do further work to make the Polish user happiest. If month names were used instead of month numbers.
But the key element of generating a correct numeric date display with no possibility — none at all — of an #ERROR! result rendering things ugly and useless will absolutely be accomplished with no great effort at all.
Column A has a sorted-descending list of some bum's Top-250 movies, in the following format: Apocalypse Now (1979)
Column B has a sorted list of My Top-100, in the same format.
Both lists have been copied and pasted into a Notepad text doc to confirm they are similar simple ASCI text – no extra spaces at the end – etc. - and then pasted back into LibreofficeCalc.
I need a function for Column C that shows any of MY movies (B) that he has NOT listed in (A).
Psudo code:
C1 = The cell value in B1 – is it anywhere in A1:A8000? If not – put B1 value into C1, otherwise leave blank.
C2 = The cell value in B2 – is it anywhere in A1:A8000? If not – put B2 value into C2, otherwise leave blank.
Etc.
I have searched and found these functions – none of which work, for whatever reason. I've modified them to 8000 as the upper range which I don't think I'll ever approach.
=IF(ISERROR(MATCH(B1,$A$1:$A$8000,0))=1,B1,"")
=IFERROR(MATCH(B1;$A$1:$A$8000;0);"")
=IFNA(VLOOKUP($B1;$A$1:$A$8000;1;0);"")
=IF(ISNA(VLOOKUP($B1;$A$1:$A$8000;1;0));"";VLOOKUP($B1;$A$1:$A$8000;1;0))
=IF(ISNA(VLOOKUP($B1,$A$1:$A$8000,1,0)),"",VLOOKUP($B1,$A$1:$A$8000,1,0))
=VLOOKUP(B1,$A$1:$A$8000,1,)
=MATCH($B1;$A$1:$A$999;0)
I'd prefer it to be a single cell function, and not VBA.
I actually solved this back in like 2001 using Excel. The trick then was I had to edit the cell and use Ctrl-Shift-Enter to create a “dynamic array”, so the function was bracketed in {} curly brackets. But now I'm using the latest LibreOffice Calc and can't get the ##$# syntax correct.
Thank you!!
Edit NOTE: testing with "A" and "00001" numbers produces very different results. Values have to look like this in both columns:
Alice (1988)
Barfly (1987)
Clueless (1995)
etc.
OK I've tested these in Open Office with the following results:-
=IF(ISERROR(MATCH(B1,$A$1:$A$8000,0))=1,B1,"")
Gives Error 508 because the commas need changing to semicolons.
**=IF(ISERROR(MATCH(B1;$A$1:$A$8000;0))=1;B1;"")**
is fine.
=IFERROR(MATCH(B1;$A$1:$A$8000;0);"")
Gives #Name? because IFERROR isn't recognised.
=IFNA(VLOOKUP($B1;$A$1:$A$8000;1;0);"")
Gives #Name? because IFNA isn't recognised.
=IF(ISNA(VLOOKUP($B1;$A$1:$A$8000;1;0));"";VLOOKUP($B1;$A$1:$A$8000;1;0))
Works but gives the opposite result.
**=IF(ISNA(VLOOKUP($B1;$A$1:$A$8000;1;0));B1;"")**
would be fine.
=IF(ISNA(VLOOKUP($B1,$A$1:$A$8000,1,0)),"",VLOOKUP($B1,$A$1:$A$8000,1,0))
Commas
=VLOOKUP(B1,$A$1:$A$8000,1,)
Commas
=MATCH($B1;$A$1:$A$999;0)
Works but just gives the position of the match.
Probably the easiest way of doing it is:-
**=IF(COUNTIF(A$1:A$8000;B1);"";B1)**
Unfortunately it does seem that strings with brackets in are giving spurious matches in Libre/Open Office. You could get round it by a substitution I guess
=IF(COUNTIF(SUBSTITUTE(SUBSTITUTE(A$1:A$10;"(";"<");")";">");SUBSTITUTE(SUBSTITUTE(B1;"(";"<");")";">"));"";B1)
entered as an array formula and copied (rather than pulled) down or of course global edit all the brackets :-(.
Now that I know the root cause of this thanks to #Lyrl, there is a further option of turning off the regular expressions as suggested or you could escape the brackets:-
=IF(COUNTIF(A$2:A$11;SUBSTITUTE(SUBSTITUTE(B2;"(";"\(");")";"\)"));"";B2)
See documentation on Regex in Open Office here
This should do it,
=IF(ISNUMBER(MATCH(B1,$A$1:$A$8000,0)),"",B1)
Tested formula
=IF(ISNA(MATCH(B1,$A$1:$A$8000,0))=TRUE(),B1,"")
I am trying to figure out why this formula is not working in my data validation field. I am using Excel 2010 and I have a large number of named ranges with a mixture of characters in a drop down list in Column c, in column d I have a dependent drop down list that currently works for some, but not all of the options listed in column C.
An example of one of the options in Column c is "10-40 Lby W" - The current formula works for that:
=INDIRECT(SUBSTITUTE(SUBSTITUTE($C13," ","_"),"-","_"))
But it won't work with this example "2/3-44K ARV" so I wrote it to look like below:
=INDIRECT(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE($C13," ","_"),"-","_"),"/","_"),"&","_"))
However for reasons unbeknowst to me, that one does not work. When I put it into a cell and try to evaluate the formula it says "The Cell currently being evaluated contains a constant". I get the generic error message "The formula you typed contains an error." when I insert the second formula in the data validation form. Usually that means a syntax error, but I am wondering if the addition of the / and & characters are the problem. Any ideas?
It seems it is a syntax error.
=INDIRECT(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE($C13." ","_"),"-","_"),"/","_"),"&","_"))
Should be:
=INDIRECT(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE($C13," ","_"),"-","_"),"/","_"),"&","_"))
I want to combine some text with a date in Excel 2013.
Let's say I have a cell A2 with a date like 30-10-2014. I tried to append the date after the text with this formula:
="Some text and a date: "&A2
But the output shows the date as a number: Some text and a date: 41942
So I tried it with the TEXT formula:
="Some text and a date: "&TEXT(A2;"dd-mm-yyyy")
But this shows Some text and a date: 30-10-yyyy and not Some text and a date: 30-10-2014
So or I do not understand how the TEXT formula works or is there some bug / issue here?
UPDATE: It looks like it's important that I have a Dutch version of Windows (7) but an English version of Excel (2013) which causes this issue!
All kudos go to #AxelRichter, thanks Axel!
It looks like that if you have a Dutch Windows but an English version of Excel (2013) the formulas get mixed up. For example, I still have the English formula names like TEXT (which would be TEKST in Dutch) but still have to use a colon instead of a comma in the formula. The format_text value of TEXT still expects the Dutch format which is different for the year (jjjj instead of yyyy).
So if you have a Dutch Windows and an English Excel version the correct formula for some text followed by a formatted date would be:
="Some text and a date: "&TEXT(A2;"dd-mm-jjjj")
I hope Microsoft will fix this, this is very annoying!
You can now use 'e' instead of 'yyyy'. The e is the universal version of yyyy a
we have the same issue at our work and I found that if I cannot influence the localization of the windows then I use a formula which in your case looks like:
="Some text and a date: "&TEXT(A2;"dd-mm-")&YEAR(A2)
It is funny that "dd" and "mm" is the same.
Excel here obviously fails. TEXT should be language agnostic.
The workaround I found, especially if you have multiple cells to format:
Calculate the desired date format in a hidden cell or white colored:
=IF(TYPE(VALUE(TEXT(DATE_CELL;"YY")))=1;"DD.MM.YYYY";"ДД.ММ.ГГГГ")
If you need, it can be extended to support multiple regions like:
=IF(TYPE(VALUE(TEXT(DATE_CELL;"YY")))=1;"DD.MM.YYYY";IF(TYPE(VALUE(TEXT(DATE_CELL;"ГГ")))=1;"ДД.ММ.ГГГГ";"DD.MM.JJJJ"))
On cells where you need dates, use previous cell as second parameter:
="Date: " & TEXT(DATE_CELL; FORMAT_CELL)
For same problem when your system or keyboard is Danish then use åååå in place of jjjj. I also struggled a lot to find this key.
However if anyone facing same problem apart from Dutch or Danish then you can check which key is correct. To find it right click on any cell and goto 'Format Cell' then select 'Custom' and find date related formats in your local language. There you can find which is the right key to be used for DATE format in your local language.
This issue is still there on Excel 2016 (or Office 365, if you may). It is caused by different language settings in Windows. This happens for languages that have different year symbols (dutch is 'jjjj', portuguese is 'aaaa'). If you're experiencing this problem, try using your local Windows language's year format.
This should work regardless of your system language or regional settings:
="Some text and a date: "&TEXT(DAY(A2);"00")&"-"&TEXT(MONTH(A2);"00")&"-"&TEXT(YEAR(A2);"0000")
Click here to see it working
[Edit] I just tested the solution with German (TT.MM.JJJJ) and English settings (DD.MM.YYYY) and it works fine!
You may need to use , instead of ; in the MS EXCEL formula (depending on your actual list separator symbol --> check your OS settings!).
Solution: To check if "jjjj" format is working:
The date you want to display in a certain format is in A1
In cell A2 link a cel to the cel with the date you want displayed in a certain format with the following formula:
=TEXT(A1;"dd/mm/jjjj")
In a 3rd cel you then place the following formula:
=IF(RIGHT(A2;4)="jjjj";TEXT(A1;"yyyy");TEXT(A1;"jjjj"))
If the 4 digits from the right are "jjjj" this formula will display the date formatted as "yyyy" else the formatting "jjjj" will be used.
The easy fix, whether directly custom formatting a cell or using TEXT(), is to use a country code for a language you know the proper formatting codes for.
For instance, I am in the US, have a US version of Excel, and am familiar with its date code formats. So I'd want to use them and to ensure they "come out" regardless of anyone's Windows or Excel version, or the country they are in, I'd do it like the following (for TEXT(), let's say, but it'd be the same idea in custom formatting):
=TEXT(A1,[$-en-US]"dd-mm-yyyy")
The function would collect the value in A1, ask Excel to treat it as a date, Excel would and would say fine, it's cool (i.e.: the value is, say, 43857 and not "horse") because it is a positive number which is a requirement for anything to be treated as a date, and let the function move on to rendering it as a date in the manner prescribed. Rather than giving an #ERROR! as it would for "horse" or -6.
The function would then read the formatting string and see the language code. It would then drop the usual set of formatting codes it loaded upon starting up and load in the formatting codes for English ("en") and in particular, US English ("US"). The rest of the string uses codes from that set so it would interpret them properly and send an appropriate string back to TEXT() for it to display in the cell (and pass on to other formulas if such exist).
I have no way to test the following, but I assume that if one were to use a format that displayed day of the week names or month names, they would be from the same language set. In other words, Excel would not think that even though you specified a country and language that you still wanted, say, Dutch or Congolese month names. So that kind of thing would still need addressed, but would be an easy fix too just involving, say, a simple lookup one could add though it'd be "fun" setting up the lookup table for each language one wanted to accomodate...
However, the basic issue that arises here, and with this problem in general, is very, very easily solved with the country codes. They aren't even hard or arcane anymore now that the [$-409] syntax has been replaced with things like [$-en-us] and [$-he-IL] and so on.
If VBA is an option... works for any locale/language
Public Function dateYYYYMMDD(dt As Date) As String
dateYYYYMMDD = Format(dt, "yyyyMMDD")
End Function