You are here:

# Excel/Excel changing a value based on 2 conditions existing in the column

Question
Greeting Tom,

I have an Excel sheet where this is a schedule. Ranges B6:B39 is Start Time, C6:C39 is end time. E6:E39 is the event identifier and  is copied into the spreadsheet manually and has unique values, but the data can be in any order.  So the data of LUNCH could be in E6 today and E39 tomorrow.  F6:F39 is a calculation of duration (End time - Start time), if the event start time is past the current time, if not, the duration is set to 0.

What I need to do is if the data of ATCNCL (Overtime that was assigned and now cancelled) exists in any cell in the range of E6:E39, then the row that contains ATBRK (Overtime Break) duration calculation should be 0.

ATCNCL can be anywhere in E6:E39 and ATBRK can be anywhere in E6:E39.

Mike.

So it sounds like you want a modification to your formula in column F.

Now
F6:  \$C6-\$E6

Added logic to show a zero for a row that hat ATBRK in column E if ATCNCL is found in any of column E across rows 6 to 39:

F6:  =if(and(countif(\$E\$6:\$E\$39,"ATCNCL")>0,\$E6="ATBRK"),0,\$C6-\$B6)

Then drag fill this down column F.

That represents how I understand your question.

--
Regards,
Tom Ogilvy

Questioner's Rating
 Rating(1-10) Knowledgeability = 10 Clarity of Response = 10 Politeness = 10 Comment Another quick and excellent answer. Works perfectly.

This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

#### Tom Ogilvy

##### Expertise

Selected as an Excel MVP by Microsoft since 1999. Answering Excel questions in Allexperts since its inception in 2001. Able to answer questions on almost all aspects of Excel's internal capabilities. If seeking a VBA solution, please specify that in your question itself so I give you the answer you want. [Excel has weak protection - if you are distributing an application, I don't answer questions on how to protect your project from your users.]

##### Experience

Extensive experience.

Education/Credentials
Master of Science (MS) degree Operations Research (ORSA)

Awards and Honors
Microsoft MVP in Excel.