# Error in function

#### Powellexcel

##### New Member
=IF(C139(SEARCH(Open,C139)), (NOW(B139*24)), CELL("contents", C4))

Can anybody suggest why this contains an error, or where it is?

### Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},\$Z\$1:\$Z\$99,\$Y\$1:\$Y\$99),2,False) to lookup Y values to left of Z values.

#### RoryA

##### MrExcel MVP, Moderator
What is this supposed to mean:
C139(SEARCH(Open,C139))

Last edited:

#### Powellexcel

##### New Member
I have a date in column A1 which is the start of a task.

In column B1 I have and option 2 phrases, stating whether the task is 'open' or 'closed', obviously there is only one of those phrases that goes into column B.

In column C I want to have the time that the task took to complete displayed in hours if the case is open in column B. If the case becomes closed in column B, then the time will stop to be whatever time that is was currently at, and for it to stop continuing the hours count.

I currently have this formula, can someone help develop this situation for me please
=IF(C139(SEARCH(Open,C139)), (NOW(B139*24), (Value if false)

#### FDibbins

##### Well-known Member
IF statement contains 3 parts...

1. condition to test for
2. what to do if test is TRUE
3. else what to do if test is FALSE

What exactly are you trying to do here?

#### Powellexcel

##### New Member
I have a date in column A1 which is the start of a task.

In column B1 I have and option 2 phrases, stating whether the task is 'open' or 'closed', obviously there is only one of those phrases that goes into column B.

In column C I want to have the time that the task took to complete displayed in hours if the case is open in column B. If the case becomes closed in column B, then the time will stop to be whatever time that is was currently at, and for it to stop continuing the hours count.

#### FDibbins

##### Well-known Member
OK maybe this?

=if(C139="Open",TODAY()-A139,"")

#### Powellexcel

##### New Member
Is there a way to convert that to display the hours the task has been open though?
And when it =closed, how to I stop the function from counting up?

#### Powellexcel

##### New Member
solved it I think ...... =IF(B5="open", NOW()-A5,CELL("contents",C5))

#### FDibbins

##### Well-known Member
oops missed that you wanted hours

#### FDibbins

##### Well-known Member
Why use CELL("contents",C5)?

you could just reference that cell?

Replies
17
Views
864
Replies
2
Views
156
Replies
7
Views
5K
Replies
22
Views
1K
Replies
12
Views
3K

1,191,607
Messages
5,987,637
Members
440,104
Latest member
thigarette

### 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.

### Which adblocker are you using?

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

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