How do I get a formula to amend certain cells only

ghrek

Active Member
Joined
Jul 29, 2005
Messages
426
Hi

I have a formula in a excel sheet that changes the date as it will not change using any other methods.

The issue im having is that it is amending some dates that I do not want to amend. I have noticed that the cells that need amending the date is on the right hand side. Is there anyway I can run the formula I have but only amend the cells that are on the right hand side.

Formula is =IF(AND(DAY(C525)<=12,MONTH(C525)<=12),DATE(YEAR(C525),DAY(C525),MONTH(C525)),C525).

see screen shot on what mean regarding right hand side. Dont know it not showing on the picture but in my workbook line 523 the date is on the left next to the number and I DONT need that amending but the other lines are next to missing from station and there I DO need amending.

missing shifts .xlsm
ABCDEF
523249121625/07/2020£0.00MISSING FROM STN25/07/2020
524249216307/07/2020£24.45MISSING FROM STN07/07/2020
525249216307/07/2020£64.00MISSING FROM STN07/07/2020
526249216307/08/2020£2.20MISSING FROM STN08/07/2020
527249216307/08/2020£5.70MISSING FROM STN08/07/2020
Sheet3
Cell Formulas
RangeFormula
F523:F527F523=IF(AND(DAY(C523)<=12,MONTH(C523)<=12),DATE(YEAR(C523),DAY(C523),MONTH(C523)),C523)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
F523:F543Expression=F523<>C523textNO
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
It sounds like you are trying to use imported data with US dates on a computer with UK regional settings or vice versa.

If that is the case then all of the dates need amending, even those that don't look as if they do.

The best way to fix this is with text to columns on the original data (column C) which will amend the dates in place.

To do this select all of the dates in column C.
Click 'Text to columns' (on the data tab).
Click Next.
Uncheck All boxes and click Next.
Change the date dropdown to MDY. (DMY if your data is in UK format and you need to convert to US).
Make sure that the radio / option button is on Date and has not moved down to 'Do not import column (skip).
Click Finish.
 
Upvote 0
Ive tried that previously and it just not changing for some reason. Thats why I had to use the formula and that works with a few glitches.
 
Upvote 0
If text to columns isn't working then it is likely that either you're trying to use the incorrect regional settings or there are invisible characters in the dates that are causing problems.

If you change the format of the dates in column C to number instead of date, which ones still look like dates?
 
Upvote 0
the ones that have dates on the left stay the same and the ones on the right stay as number
 
Upvote 0
With the ones on the right being those where the day is greater than 12? 25/07/2020 for example?

If that is the case then you need to set the date dropdown as DMY when you follow the data validation steps.

*** You will need to change the format of column C to UK date (DD/MM/YYYY) before attempting text to columns. ***
 
Upvote 0

Forum statistics

Threads
1,215,430
Messages
6,124,852
Members
449,194
Latest member
HellScout

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