excel function or macro delete numbering in front of text - vba

I searched but couldn't find any answer.Need your help tol solve the issues. so here is the problem:
I have a spreadsheet with
Cell A4 : 1.1 ABC
Cell A5: 1.10 BCD 200 ABC
Cell A6: 5.8 ABCD ABCD
So what I want is to delete 1.1 , 1.10 5.8 in front of the text including the space after the number as well.
I tried right function but didn't solved the issue.
Transformed Cell A4:ABC
Transformed Cell A5:BCD 200 ABC
Transformed Cell A6:ABCD ABCD
It should check all the A colomn till A100 for example

It should work if you formulate it this way:
=RIGHT(TRIM(A1),LEN(TRIM(A1))-FIND(" ",TRIM(A1)))
By trimming, you're making sure you get rid of trailing spaces before dealing with the real problem (taking only what's to the right of the first remaining space)
Sometimes even if your language is set to English, your localization may be different from other users'. Changing all , into ; may often time solve the "We found a problem with this formula" error message. In this case, this formula is compatible with #ahmet 's setup.
=RIGHT(TRIM(A1);LEN(TRIM(A1))-FIND(" ";TRIM(A1)))
Try this if you want to display Error when there's an error with the formula. Replace "Error" with "" if you want the cell to remain empty if there is an error.
=IFERROR(RIGHT(TRIM(A1);LEN(TRIM(A1))-FIND(" ";TRIM(A1))); "Error")

Try this:
=RIGHT(A1, LEN(A1) - FIND(" ",A1,1))

Related

Subscripts in 'user-defined' cell formatting

In libreoffice calc, I use Format cells > Number > User-defined > Format code > 0.000 “kg” to display 200 kg in the cell A1. Now, in cell A2, I can use the formula : A1 x 2 and obtain 400. This is very convenient. Just like this, in the format code 0.000 “CA”, Is it possible to display 'A' as the subscript. Please give your suggestions. Thanks.
Edit: I tried using the unicode. It works well inside the cell. But cannot be used in the format cell dialogue box. The screenshot is attached below. The problems are marked with a red rectangle and a green arrow. Please verify it.
Start typing the format code simply into the cell: 0.000 "C
Now choose Insert-Special Character...
Use this tool to find and select the desired symbol
Complete the cell input
Copy the result and paste it as format code in the Format-Cells... window
This is a general principle for constructing unusual format codes using special characters. Of course, you can simply copy this particular line of format code directly from StackOverflow - 0.000" Cₐ"

Dependent Drop-Down Lists with functions indirect or index+match functions still gets me a #VALUE! or #REF! error

I followed 2 tutorials respectively
-indirect dependent drop down lists
-index and match dependent drop down lists
For the indirect function =INDIRECT(C6) as soon as I use some names with spaces e.g. 'selfish yes' they will end up with underscores when I create the name from a selection ctrl+shift+F3 as you can see in the 'Name Manager' I have now selfish_yes). If I use indirect on 'selfish yes' I get a #REF! error. As soon as there are no spaces such as 'generous' I have a #VALUE! error.
DependantDropDownList
But if I double now double click on cell D18 so I have the code highlighted '=INDIRECT(D18)' and I then press CTRL+SHIFT+ENTER I get the first value of my 2nd dropdown list which is 'grrrr' but I can't select the following 'NotWorking' or 'NotHappy'.
Result after Ctrl+Shift+Enter on cell E18
I can change D18 from angry to happy and see again the first element from my list 'yesss' appear. But as soon as I double click again on E18 and press Enter I get the #Value! error again
For the index and match function
I used e.g. for cell D9 =INDEX(D2:E3,,MATCH($C$9,$D$1:$E$1,0)) as per the tutorial and I get #Value! Error independant with space or not. I tried an example with no spaces anywhere with 'angry' and 'happy' and still get the same.
I really used the same way as per the 2 tutorials and don't understand what I'm doing wrong. I checked also the separator under clock and Region which for me has no influence on this case I think.
ClockAndRegion
What I want to achieve is simple and I can't get my hand on what goes wrong. Ideally I want my dependant double drop down list to have numbers and '.' for example
1.Technical Risk [1st list with the 2nd list being 1.1-2-3...]
1.1 Definition of Perimeter
1.2 Definition of requirements
1.3 ...
Risk Management
2.1 Project Management
2.2 ...
If I select 1. in my first cell I want the next cell to offer 1.1, 1.2, ... which is what the 2 tutorials show...
Thanks if someone finds what's blocking it'd be really appreciated I'd really want to break down this problem.
I found the solution with a friend, I was simply not putting the formula inside the source of the data validation of my list {=INDEX($U$12:$X$18,,MATCH(G8,$U$11:$X$11,0))}. When this code was pasted inside everything was ok.
enter image description here

IF Function vba

I need a macro that can do this:
If column AB5 has a blank cell, then then column A5 will take the value from column U5.
if column AB5 is not a blank cell (contains text), then column A5 will take the value from AC5.
This will run for all the data at column AB
I tried to use IF function, =IF(ISBLANK(AB5), U5, AC5) but it will reflect the wrong data if the cell contains text where they will still take U5 value.
Ideally is if it can be done using macro, but IF function is also fine too!
Please help thanks!
I'd guess that your cells are not truly blank. My guess would be that AB5 has formula in it. Try:
=IF(LEN(AB5)=0,U5,AC5)
Edit
If it has a single space in there rather than being empty:
=IF(LEFT(AB5,1)=" ",U5,AC5)
or
=IF(LEN(AB5)<2,U5,AC5)
Perhaps try reversing the formula:
=IF(LEN(AB5)<>0,AC5,U5)
=IF(AB5<>"",AC5,U5)
As they are all 3 letter acronyms try this one:
=IF(LEN(AB5)>2,AC5,U5)
A foolproof way to be sure that there are no spaces as input errors:
=IF(LEN(SUBSTITUTE(AB5," ",""))=3,AC5,U5)
Let me know if any of these work, I can mock up a VBA function for you if they don;t but they should work.
Your function
=IF(ISBLANK(AB5), U5, AC5)
should work fine. If you drag down the formula in the A Column, the numbers in the formula should change:
=IF(ISBLANK(AB6), U6, AC6)
etc. Is this happening? What is your formula in cell A6?
=IF(AB5="", U5, AC5)
try that, should work

#Value! error with =(A1+A2)

I'm trying to add multiple cells with the formula =(A1+A2+A3...etc)
Which works, but if all the cells are empty then I get a #Value!
PLEASE NOTE:
Yes I am aware the proper way to add cell values is with =SUM(A1:A3)
However the cells I'm adding together each have their own functions to get their numbers, and the =SUM function won't add them together.
So! Is there a way I can make =(A1+A2+A3...etc) not give me a #Value! error in the cell that's supposed to total them if ALL the cells (A1,A2,etc) are empty? (as in, the cell with the total will just be blank)
Yes I know this is overly complicated. I'm working with that I've got.
EDIT
I might have figured out my problem. My 'false' statement in the function of the cells that were being added is "" in order to make the cell not have a 0 in it when empty. When it tries to add those cells together, if they all read "" and none are a number that's when I get the #Value! error. Not sure yet what I'm going to do about that...
EDIT 2
Yup. Problem was caused by having a non-numerical value as my false statement. Didn't want a bunch of zeros everywhere, but oh well I guess.
I tried both Excel 2007 and Calc 3.4.1, and neither one of these generated the #Value! that you mention. I am thinking that perhaps your source cells' equations are producing a value that is causing this to error out.
For example, if one of the cells has a String value, then this will be the result. This can be detected with the TYPE() function. for example:
=( IF(TYPE(A1)=1;A1;0) + IF(TYPE(A1)=1;B1;0) + ...)
this will make sure that you are actually adding numbers before the addition takes place.
edit
See: http://www.techonthenet.com/excel/formulas/type.php
for details on TYPE()

Linking cells in excel with a specific format

I am trying to link cells in excel on two different work sheets.
I am using the formula eg: cell1 = cell2 + cell3. The numbers that I have in cell2 and cell3 are in format of 100% (1) and 50% (2). I just want to add numbers 1 and 2 so that my cell1 will have number 3.
Is it possible to do without changing the cell formats?
Thanks a lot.
If you don't care about the percentages, just copy your column with the percentages and change the format of that column to value and in sheet 2, do addition on that column instead.
Unfortunately when a cell has a format of percentage and a user enters a number, it is converted into what it means given the context of the format. It's not like what is being displayed is wildly different than what is 'hidden' inside the cell. When you reformat a cell, that data is reformatted as well, so 50% becomes .5 even if you had originally entered 50 in the cell before changing it's format. Format is more than just 'display format' so maybe that's where the confusion is.
If you want to add the cells in the percentage row and not bother with reformatting the formula cell you can cheat and treat it as a string to get rid of that %. You could do =Left(A2+A3, Len(A2+A3)) that will give you the 1.5 answer without having to format te cell.
Not sure i understood your question but i'll give some elements:
formula and formats are separated in Excel, thus, you can set a formula in A1, say =A2+A3 but displays the value the way you wish
for instance, if A2 contains 100% and A3 contains 50%, then the result in A1 is worth 1.5
you can set the format of A1 the way you wish (Right-clic > Format cells > Number tab), for instance, decimal, the cell will then display 1.5 but if you choose percentage, the cell will then display 150%
Please elaborate your question if needed.
[EDIT] New answer thanks to your comment:
If i understand well, you want to sum up the values between brackets in your cell (whatever is before, event percentages in your case).
Then, you can try this in cell A3:
=MID(A1,FIND("(",A1)+1,FIND(")",A1)-FIND("(",A1)-1 )+MID(A2,FIND("(",A2)+1,FIND(")",A2)-FIND("(",A2)-1 )