Subtract time

I want to subtract time and multiply with the number .
For example
Cell A1 = 11:00PM
Cell A2 = 2:00 AM
Cell A3 = 4 ( any value )

In cell A4 i want  cell A2 - Cell A1 * Cell A3
Ramesh sharmaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Wayne Taylor (webtubbs)Commented:

Just make sure your formatting is set correctly to display a time.
Ramesh sharmaAuthor Commented:
I tried this but getting a error ‘#####’

May be my formatting is wrong .
Can you help me with that
Wayne Taylor (webtubbs)Commented:
That "error" is due to your column being too narrow. Widen it and it will display correctly.

To modify the formatting, right-click the cell and select "Format Number". Select your desired format from the Number tab.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Ramesh sharmaAuthor Commented:
Getting wrong answer
Correct answer should be 6 as A2-A1 =2 * 3

I have formatted cell A1 and cell A2  in h:mm format
Ramesh sharmaAuthor Commented:
I have also attached file so that you can have a look
Wayne Taylor (webtubbs)Commented:
1:00 is less than 23:00 due to no date in the time values and results in the negative number, so we need to account for that. Use this formula instead...

=IF(A2<A1, A2-A1+1, A2-A1)*A3

BTW, the formatting of cells A1 and A2 won't have any impact. It's cell A4 that you need to format.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
Please try this...


Open in new window

Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
The chosen answers resolved the original question.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.