subtract the numerical value from month

michaelsmithgall

New Member
Joined
Feb 22, 2011
Messages
19
Im afraid this is very simple and I am just drawing a complete blank. I have a process on my internal system that requires me to look up the two digit Month on a file and subtract the current months two digit value to arrive at a value we are going to use for additional calculation.

so we may have 02 in the system to reprsent Feb and today would be 04 to represent April. i need to subtract 04 from 02 and get 10.

What i would like is:
A1 to receive the system date from the user
A2 to automatically reflect the two digit code from this month
a3 to show the calculated new month code (02-04=10)

thank you in advance for any help you can provide
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Try this

User enters month number in A1

=MONTH(DATE(2011,A1-MONTH(TODAY),1))

the year is irrelevant...
 
Upvote 0
HotPepper, it worked fine but i ran acros one combination that caused it to fail. I had to alter your formula slightly so maybe i caused it. here is what i have now

=MONTH(DATE(1,B3-B4,1))

i essentiall removed the Today() funtion so that both fields would come from user input (decided to have them do it for other reasons)

it works fine until B3=1 and B4=12, try and see if you get a fail. all other combination i have tried seem to work except that.

Since B4 is this month I guess I have 8 months to figure it out before anyone is aware of this. LOL
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,831
Members
452,946
Latest member
JoseDavid

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