Macro to adjust cell content accoding to cell value

Lux Aeterna

Board Regular
Joined
Aug 27, 2015
Messages
201
Office Version
  1. 2019
Platform
  1. Windows
Hello again!!

I was wondering if you could write a macro for me that adjusts cell calue as follows; I enter data in column H, from H5 to H10033. Please note that if I have to edit the cell value at a later stage, I'd like the macro to leave the new value as is.

Thank you in advance!

If cell value isFormat (column H)Result example
datedd/mm/yy or dd/mm/yyyyy (e.g. 15/12/21 or 15/12/2021)Adjust to dd/mm/yyyy format (i.e. 15/12/2021)
dd/mm (e.g. 15/12)This year's date (i.e. 15/12/2022) - no auto-update when year changes!
mm/yyyy (e.g. 8/2018)August 2018
number1 (just for number 1)Προ 1 έτους
2 to 40Προ {cell H} ετών (i.e. Προ 22 ετών)
41 to 99Προ {cell H value - cell D value in the same row} ετών. (i.e. If D5 is 20 and H5 is 41, Προ 21 ετών)
Please note that;
- cell D is calculated through a function and it might be empty. In that case, I'd like the macro to adjust the content in cell H when cell D is filled.
- cell D value might be altered at a later stage. In that case, I'd like the macro to update the content in cell H.
text or any other type of dataLeave as is
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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