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

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
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,223,237
Messages
6,170,928
Members
452,366
Latest member
TePunaBloke

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