Adding or subtracting 1 from number value in cell that also contains text

LeonardH

New Member
Joined
Dec 21, 2013
Messages
33
Office Version
  1. 365
Platform
  1. Windows
Hello Everyone,

I'm looking for a formula that would cause a number value to either increase or decrease by one. Examples of text include: Apr Y0, May Y0, Jun Y1, Jul Y4. The common denominator is that the number is always preceded by " Y".

Thanks in advance for all your expertise! Please let me know if you have any questions.
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
If it is always 5 characters before the number, then is this what you are after?

=LEFT(A1,5)&REPLACE(A1,1,5,"")+C1

1594733587704.png
 
Upvote 0
So, not quite. And let me add a little more, with more context. I also found that I'll need to subtract instead of add... This will make it tricky

The bottom row is a sample of the values that will be queried into my worksheet. The top row is an example of the values I would like to see.

Nov Y-1Dec Y-1Year-1Jan Y0Feb Y0Mar Y0Y0 Q2Y0 Q3Y0 Q4Year0
Nov Y0Dec Y0Year0Jan Y1Feb Y1Mar Y1Y1 Q2Y1 Q3Y1 Q4Year1

So far to get the "Nov Y-1", I am using:

=(LEFT(A2,SEARCH(" Y",A2)+1)&RIGHT(A2,LEN(A2)-(SEARCH(" Y",A2)+1))-1)

Now the tricky part is coming up with if functions that also address the other two formats: Year# and Y# Q#. The only numbers that should change are the ones associated with years.

Thank you for everyone's help. This one is a challenge.
 
Upvote 0

Forum statistics

Threads
1,215,545
Messages
6,125,448
Members
449,227
Latest member
Gina V

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top