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?
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:
=(A2-A1)*A3

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

May be my formatting is wrong .
Can you help me with that
0
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.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy 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
7FE2F4D7-63FA-4565-B989-C7FE21054AE.jpeg
0
Ramesh sharmaAuthor Commented:
I have also attached file so that you can have a look
0
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.
0

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

=MOD(A2-A1,1)*24*A3

Open in new window

Subtract-Time.jpg
0
Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
The chosen answers resolved the original question.
0
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.