Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Calculations with conditions

I have a range of data that a user will constantly update. There are
four columns:

ArrivalTime (Time)
Appointment or Walk-In (A or W)
Appointment Time (Time)
Wait Time (Calculation of Time)

The user will enter:
Arrival Time in (B2)
A or W in (C2)
Appointment Time (if C2 = "A") in (D2).
and so on in B3, C3, D3

What I want to do is in Column E, calculate the Wait time accordingly
when a user clicks a button.
If Appointment - WaitTime = Now - Appointment Time
If Walk-In - WaitTime = Now - Arrival Time

Now the user may enter multiple rows at one time and then click the
update button.

How do I have it run through the range and run the calculations?

Brendon
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 395
Default Calculations with conditions

Aircode (for cell E2):

=If(C2="A", IF(NOW()D2,NOW()-D2),""),NOW()-B2)

However, NOW() will continually update each time the sheet updates, and
while that gives you a picture of how long everyone has been waiting, it
doesn't stop the clock when a person actually starts their appointment. The
same would be true if you do this all in VBA; if you want to store their
final wait time, you'll need to add one more column with a flag to indicate
that an appointment has started, or, have your VBA be row-specific (only
update the active row).

HTH,
Keith

"Fester" wrote:

I have a range of data that a user will constantly update. There are
four columns:

ArrivalTime (Time)
Appointment or Walk-In (A or W)
Appointment Time (Time)
Wait Time (Calculation of Time)

The user will enter:
Arrival Time in (B2)
A or W in (C2)
Appointment Time (if C2 = "A") in (D2).
and so on in B3, C3, D3

What I want to do is in Column E, calculate the Wait time accordingly
when a user clicks a button.
If Appointment - WaitTime = Now - Appointment Time
If Walk-In - WaitTime = Now - Arrival Time

Now the user may enter multiple rows at one time and then click the
update button.

How do I have it run through the range and run the calculations?

Brendon

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Calculations with conditions

This works, but if the appt time is greater, then it doesn't calculate
(or show " ")

I guess my end result would be to loop through each cell, look for the
A or W, and calculate the wait time and add to the cell (E2), is this
possible, or does it need to be done one by one?


On Sep 16, 3:51*pm, ker_01 wrote:
Aircode (for cell E2):

=If(C2="A", IF(NOW()D2,NOW()-D2),""),NOW()-B2)

However, NOW() will continually update each time the sheet updates, and
while that gives you a picture of how long everyone has been waiting, it
doesn't stop the clock when a person actually starts their appointment. The
same would be true if you do this all in VBA; if you want to store their
final wait time, you'll need to add one more column with a flag to indicate
that an appointment has started, or, have your VBA be row-specific (only
update the active row).

HTH,
Keith



"Fester" wrote:
I have a range of data that a user will constantly update. *There are
four columns:


ArrivalTime (Time)
Appointment or Walk-In (A or W)
Appointment Time (Time)
Wait Time (Calculation of Time)


The user will enter:
* Arrival Time in (B2)
* A or W in (C2)
* Appointment Time (if C2 = "A") in (D2).
and so on in B3, C3, D3


What I want to do is in Column E, calculate the Wait time accordingly
when a user clicks a button.
* If Appointment - WaitTime = Now - Appointment Time
* If Walk-In - WaitTime = Now - Arrival Time


Now the user may enter multiple rows at one time and then click the
update button.


How do I have it run through the range and run the calculations?


Brendon- Hide quoted text -


- Show quoted text -


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Conditions when we can set the excel code calculations to manual andwhen we should not Yuvraj Excel Programming 3 February 24th 09 03:07 PM
index(match) Wind Uplift Calculations (match four conditions) JMeier Excel Worksheet Functions 8 August 1st 08 01:45 AM
Countif Conditions - Use of conditions that vary by cell value JonTarg Excel Discussion (Misc queries) 1 May 30th 08 01:21 PM
shade cells based on conditions - i have more than 3 conditions Mo2 Excel Worksheet Functions 3 March 30th 07 07:19 AM
calculations on conditions Fawn Excel Worksheet Functions 0 November 17th 06 05:51 AM


All times are GMT +1. The time now is 01:54 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"