Use formula to change cell value dependant on another

sharky12345

Well-known Member
Joined
Aug 5, 2010
Messages
3,422
Office Version
  1. 2016
Platform
  1. Windows
I've got this formula which updates a cell dependant on another - it shows either true or false dependant on the other value;

=IF(OR(LEFT(J26,5)="Leave",LEFT(J26,4)="Sick",LEFT(J26,4)="Rest Day"),FALSE,OR(,LEFT(J26,1)="E",LEFT(J26,1)="D",LEFT(J26,1)="L",LEFT(J26,1)="N"))

What I'm trying to do is add a condition that will show 'true' if J26 is 'NTE' but I can't get it to work.

The formula was on a worksheet sent to me, so not something I have created myself and if I'm honest I don't fully understand it, so any help that can be given would be appreciated.
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Code:
=IF(J26="NTE",TRUE,IF(OR(LEFT(J26,5)="Leave",LEFT(J26,4)="Sick",LEFT(J26,4)="Rest Day"),FALSE,OR(,LEFT(J26,1)="E",LEFT(J26,1)="D",LEFT(J26,1)="L",LEFT(J26,1)="N")))
 
Upvote 0
I've got this formula which updates a cell dependant on another - it shows either true or false dependant on the other value;

=IF(OR(LEFT(J26,5)="Leave",LEFT(J26,4)="Sick",LEFT(J26,4)="Rest Day"),FALSE,OR(,LEFT(J26,1)="E",LEFT(J26,1)="D",LEFT(J26,1)="L",LEFT(J26,1)="N"))

What I'm trying to do is add a condition that will show 'true' if J26 is 'NTE' but I can't get it to work.

The formula was on a worksheet sent to me, so not something I have created myself and if I'm honest I don't fully understand it, so any help that can be given would be appreciated.
Note that the red part will never be true. Did you mean 8 instead of 4?
 
Upvote 0
Hadn't spotted that Peter so thank you, and thanks to Syed too!!
 
Upvote 0
What I'm trying to do is add a condition that will show 'true' if J26 is 'NTE' but I can't get it to work.
I don't think you need any change at all to your original formula for that.
If J26 is 'NTE' it would already meet the existing condition in your formula LEFT(J26,1)="N" which would cause that final OR() function to return TRUE.

Are you sure that it didn't work without change?

As an aside, you can shorten that second OR() function as shown in red below and, depending on what text may appear in J26, you may be able to shorten the first one as shown in blue.

=IF(OR(LEFT(J26,4)={"Leav","Sick","Rest"}),FALSE,OR(LEFT(J26,1)={"E","D","L","N"}))
 
Last edited:
Upvote 0
Perfect, I'll give that a try. It certainly wasn't working before I made the change but it is now....thank you Peter!
 
Upvote 0
It certainly wasn't working before I made the change ....
Hmm, must have been something else going on. Here's my sheet with the formula exactly as in post 1 and it is returning True for 'NTE' as I would expect.

Excel Workbook
JK
26NTETRUE
True False
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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