Change number in string in VBA [closed] - excel

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I have a column in an excel-sheet like this:
a_bcdfg02fga
k_lmnop05fab
x_yzabd03ea
I would like to substract the number by 1 in these string to get a column like this
a_bcdfg01fga
k_lmnop04fab
x_yzabd02ea
I never face such a problem so I don't even know where to start.

Use a simple formula:
=LEFT(A1,7)&text(MID(A1,8,2)-1,"00")&MID(a1,10,20)

Related

If column contains Y concatenate headings [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
Got a list of data with 7 columns each with a Y in, I want to add a formula that will check for a Y in the column then concatenate the headings if correct and ignore if not.
See below example
Is this possible?
Try this User Defined Function.
=TextJoinIfs(", ", 0, 0, B$1:H$1, B2:H2, "y")
I did not get the TextJoinIfs to work, sadly, looks neat. If you have the same problem maybe this can be a solution. Not pretty I know...
=TEXTJOIN(",",TRUE,IF(IFERROR(MATCH("Y",A2),FALSE),"col 1",""),IF(IFERROR(MATCH("Y",B2),FALSE),"col 2",""),IF(IFERROR(MATCH("Y",C2),FALSE),"col 3",""),IF(IFERROR(MATCH("Y",D2),FALSE),"col 4",""),IF(IFERROR(MATCH("Y",E2),FALSE),"col 5",""),IF(IFERROR(MATCH("Y",F2),FALSE),"col 6",""),IF(IFERROR(MATCH("Y",G2),FALSE),"col 7",""),)

How to delete the columns except the first three columns? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have a worksheet where after all the operations are done I want to clear all the contents except in first three columns (A, B, C).
Is it possible to achieve using VBA?
To remove formula and values use:
Range("D:XFD").ClearContents
To remove formula, values and formatting, use:
Range("D:XFD").Clear

Extract address cell in table [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I would like to have the range (address) of the cell where is my table like :
Column = Range(table_NB.DataBodyRange(1, 1))
Do you have the correct code for this ?
To get the address of the first cell in a table:
MsgBox ListObjects(1).DataBodyRange.Cells(1, 1).Address

Change a full column of such as F01U123456 to F.01U.123.456 [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Is it possible to change a full column of such as F01U123456 into F.01U.123.456 with an Excel formula, or would it require a macro?
A formula is sufficient:
=LEFT(A1)&"."&MID(A1,2,3)&"."&MID(A1,5,3)&"."&MID(A1,8,3)

Replaces text.number to number [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I have a excel cells with username.id.I want to delete usernames and I just want ID's to be displayed in cells.
EG: sunny.123 should be transformed to 123
Try this formula:
=RIGHT(A1,LEN(A1)-SEARCH(".",A1))*1
This assumes that your IDs are always using the schema String.Number
If this is not always the case, this formula handles a few more situation:
=IF(ISERROR(SEARCH(".",A1)),IF(ISNUMBER(A1),A1,"Pattern does not match User.Id!"),RIGHT(A1,LEN(A1)-SEARCH(".",A1))*1)

Resources