We’d like to remind Forumites to please avoid political debate on the Forum.
This is to keep it a safe and useful space for MoneySaving discussions. Threads that are – or become – political in nature may be removed in line with the Forum’s rules. Thank you for your understanding.
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!
The Forum now has a brand new text editor, adding a bunch of handy features to use when creating posts. Read more in our how-to guide
Removing Text from a Cell
Cotta
Posts: 3,667 Forumite
in Techie Stuff
Hi All,
I have a code in a cell to return a value and the value returned is exactly what I require, however I was wondering if it is possible to remove the last four characters returned and if so how is this done? The code I am using is as follows:
=VLOOKUP(A30,'Personal Finance'!A:IV,MATCH(My Details!H29,'Personal Finance'!1:1,0),0)
I have a code in a cell to return a value and the value returned is exactly what I require, however I was wondering if it is possible to remove the last four characters returned and if so how is this done? The code I am using is as follows:
=VLOOKUP(A30,'Personal Finance'!A:IV,MATCH(My Details!H29,'Personal Finance'!1:1,0),0)
0
Comments
-
-
Thanks,
I have tried to use the solutions within this already, however the following returns errors:
=right(H30,-4),VLOOKUP(A30,'Personal Finance'!A:IV,MATCH(My Details!H29,'Personal Finance'!1:1,0),0)0 -
=right(VLOOKUP(A30,'Personal Finance'!A:IV,MATCH(My Details!H29,'Personal Finance'!1:1,0),0),len(VLOOKUP(A30,'Personal Finance'!A:IV,MATCH(My Details!H29,'Personal Finance'!1:1,0),0)-4)
but did you not ask for =left in the first post?0 -
Thanks,
I have tried to use the solutions within this already, however the following returns errors:
=right(H30,-4),VLOOKUP(A30,'Personal Finance'!A:IV,MATCH(My Details!H29,'Personal Finance'!1:1,0),0)
This is just a syntax error.
This version is trying to remove the last 4 characters from the cell, and then doing the lookup. It can't remove characters if the cell is blank (which it will be until the lookup completes).0 -
=right(VLOOKUP(A30,'Personal Finance'!A:IV,MATCH(My Details!H29,'Personal Finance'!1:1,0),0),len(VLOOKUP(A30,'Personal Finance'!A:IV,MATCH(My Details!H29,'Personal Finance'!1:1,0),0)-4)
but did you not ask for =left in the first post?
Yes it's the last four characters in the cell that I am trying to remove. Attempting your formula (copied below) and I am being returned the "#VALUE!" error message.
=RIGHT(VLOOKUP(A30,'Personal Finance'!A:IV,MATCH(My Details!$H$29,'Personal Finance'!$1:$1,0),0),LEN(VLOOKUP(A30,'Personal Finance'!A:IV,MATCH(My Details!$H$29,'Personal Finance'!$1:$1,0),0)-4))0 -
Yes it's the last four characters in the cell that I am trying to remove. Attempting your formula (copied below) and I am being returned the "#VALUE!" error message.
=RIGHT(VLOOKUP(A30,'Personal Finance'!A:IV,MATCH(My Details!$H$29,'Personal Finance'!$1:$1,0),0),LEN(VLOOKUP(A30,'Personal Finance'!A:IV,MATCH(My Details!$H$29,'Personal Finance'!$1:$1,0),0)-4))
Looks like an issue with brackets. Try this:-
=RIGHT(VLOOKUP(A30,'Personal Finance'!A:IV,MATCH(My Details!$H$29,'Personal Finance'!$1:$1,0),0),LEN(VLOOKUP(A30,'Personal Finance'!A:IV,MATCH(My Details!$H$29,'Personal Finance'!$1:$1,0),0))-4):wall: Flagellation, necrophilia and bestiality - Am I flogging a dead horse? :wall:
Any posts are my opinion and only that. Please read at your own risk.0 -
This whole thing would be greatly simplified it you simply put the VLOOKUP formula in a cell/column, set that column to Hide, then used an adjacent cell/column for the LEFT or RIGHT formula.
Will =RIGHT(Cell,-4) even work? I've never seen the LEFT or RIGHT commands used with negative numbers. The obvious formula would be:
=LEFT(Cell,LEN(Cell)-4)
where Cell is the (hidden) cell containing the VLOOKUP.0 -
Thanks very much folks, error has now been corrected.0
This discussion has been closed.
Confirm your email address to Create Threads and Reply
Categories
- All Categories
- 353.5K Banking & Borrowing
- 254.1K Reduce Debt & Boost Income
- 455K Spending & Discounts
- 246.6K Work, Benefits & Business
- 602.9K Mortgages, Homes & Bills
- 178.1K Life & Family
- 260.6K Travel & Transport
- 1.5M Hobbies & Leisure
- 16K Discuss & Feedback
- 37.7K Read-Only Boards