+ Reply to Thread
Results 1 to 16 of 16

Need help to simplify my formulas since the calculation get slow.

  1. #1
    Registered User
    Join Date
    04-02-2018
    Location
    Philippines
    MS-Off Ver
    2007
    Posts
    24

    Need help to simplify my formulas since the calculation get slow.

    Hi there,
    Im newbie so please understand,

    I have this formula on sheet Room Visual

    =IF(AND($A6<>"",$A6<>""),1-SUMPRODUCT((CheckIn<=C$5)*(CheckOut>=C$5+1)*((RoomResN=$A6))),"")

    value of CheckIn = =OFFSET(Reservation!$D$5:$D$1000,0,0,COUNTA(Reservation!$D$5:$D$1000),1)

    value of CheckOut = =OFFSET(Reservation!$E$5:$E$1000,0,0,COUNTA(Reservation!$E$5:$E$1000),1)

    value of RoomResN =
    =OFFSET(Reservation!$N$5,0,0,MAX(COUNTA(Reservation!$N:$N),COUNTA(Reservation!$O:$O),COUNTA(Reservation!$P:$P),COUNTA(Reservation!$Q:$Q),COUNTA(Reservation!$R:$R),COUNTA(Reservation!$S:$S),COUNTA(Reservation!$T:$T),COUNTA(Reservation!$U:$U),COUNTA(Reservation!$V:$V),COUNTA(Reservation!$W:$W))-1,10)

    This formula makes the excel computation really slow. Anyway I can simplify the formula? Thank You.

    Document Attached (Macro Enabled)
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: Need help to simplify my formulas since the calculation get slow.

    Do not use full column ranges such as Reservation!$N:$N. Limit them to the rows necessary.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: Need help to simplify my formulas since the calculation get slow.

    To be a bit more specific.... Whole column references aren't necessarily bad. Very often Excel can handle them very well. However, in array formulae, or in SUMPRODUCT or with volatile functions, they can be awful. OFFSET is volatile. It recalculates every time something is changed on your sheet. Your last named range contains ~9 whole column references. Every time something changes Excel looks down 1,000,000 rows 9 times. That will slow you up.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  4. #4
    Registered User
    Join Date
    04-02-2018
    Location
    Philippines
    MS-Off Ver
    2007
    Posts
    24

    Re: Need help to simplify my formulas since the calculation get slow.

    -AliGW
    I tried to limit the rows like Reservation!$N1:$N1000 but im getting error on Room Visual Sheet.

    -Glenn Kennedy
    I've read about using INDEX instead of OFFSET but I really dont know how to convert specially the value of RoomResN (Range Name).

    I only need rows up to 2000 for 1 year reservations... I just dont know how to limit the formulas...

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: Need help to simplify my formulas since the calculation get slow.

    There is an issue here:

    =OFFSET(Reservation!$N$5,0,0,MAX(COUNTA(Reservation!$N1048569:$N988),COUNTA(Reservation!$O1048569:$O988),COUNTA(Reservation!$P1048569:$P988),COUNTA(Reservation!$Q1048569:$Q988),COUNTA(Reservation!$R1048569:$R988),COUNTA(Reservation!$S1048569:$S988),COUNTA(Reservation!$T1048569:$T988),COUNTA(Reservation!$U1048569:$U988),COUNTA(Reservation!$V1048569:$V988),COUNTA(Reservation!$W1048569:$W988))-1,10)

    Your array is wrong, surely?

  6. #6
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: Need help to simplify my formulas since the calculation get slow.

    i'd use smart table

    BTW, there is no xlsb in 2003
    Attached Files Attached Files
    Last edited by tim201110; 04-02-2018 at 11:16 AM.

  7. #7
    Registered User
    Join Date
    04-02-2018
    Location
    Philippines
    MS-Off Ver
    2007
    Posts
    24

    Re: Need help to simplify my formulas since the calculation get slow.

    Hi Ali,

    Sorry the attachment was not updated, the value of NewResN is:

    =OFFSET(Reservation!$N$5,0,0,MAX(COUNTA(Reservation!$N:$N),COUNTA(Reservation!$O:$O),COUNTA(Reservation!$P:$P),COUNTA(Reservation!$Q:$Q),COUNTA(Reservation!$R:$R),COUNTA(Reservation!$S:$S),COUNTA(Reservation!$T:$T),COUNTA(Reservation!$U:$U),COUNTA(Reservation!$V:$V),COUNTA(Reservation!$W:$W))-1,10)

    That would remove the errors but computation is slow.

  8. #8
    Registered User
    Join Date
    04-02-2018
    Location
    Philippines
    MS-Off Ver
    2007
    Posts
    24

    Re: Need help to simplify my formulas since the calculation get slow.

    Quote Originally Posted by tim201110 View Post
    i'd use smart table

    BTW, there is no xlsb in 2003
    Thanks Tim, I will check it out.

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: Need help to simplify my formulas since the calculation get slow.

    Can you explain what this formula:

    =IF(AND($A6<>"",$A6<>""),1-SUMPRODUCT((CheckIn<=C$5)*(CheckOut>=C$5+1)*((RoomResN=$A6))),"")

    is meant to be doing? What result do you expect it to produce a) when a room is unoccupied and b) when it is occupied?

  10. #10
    Registered User
    Join Date
    04-02-2018
    Location
    Philippines
    MS-Off Ver
    2007
    Posts
    24
    The formula aims to have a result of 1, 0 and -1. 1 for room is occupied, 0 for vacant and -1 for double reservation. When a reservation was added on the first sheet, the formula will automatically add the dates and duration on the next sheet. The formula will match the corresponding date and room number from sheet2 to sheet 1.

  11. #11
    Registered User
    Join Date
    04-02-2018
    Location
    Philippines
    MS-Off Ver
    2007
    Posts
    24

    Re: Need help to simplify my formulas since the calculation get slow.

    Thank you for all your help, I was able to reduce calculation from 5 seconds to 2 seconds which is considerable. The problem really lies on the value of the Range RoomResN.

    Thanks to AligW for reminding to limit the ranges so I change it to:

    =OFFSET(Reservation!$N$5,0,0,MAX(COUNTA(Reservation!$N$5:$N$1200),COUNTA(Reservation!$O$5:$O$1200),COUNTA(Reservation!$P$5:$P$1200),COUNTA(Reservation!$Q$5:$Q$1200),COUNTA(Reservation!$R$5:$R$1200)),5)

    I also learned that when limiting the value so instead of $N:$N, I used $N$5:$N$1200, I should use absolute value both the row and the column or else the Name Range will change relative to the pointers location. I also reduce the number of coulumns form 10 to 5. Now my formula is ok.

    Thanks also TIM for the help.

  12. #12
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: Need help to simplify my formulas since the calculation get slow.

    You're welcome!

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  13. #13
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: Need help to simplify my formulas since the calculation get slow.

    For personal reasons, I wasn't able to look back at this one... However, does the

    =IF(AND($A6<>"",$A6<>""),1-SUMPRODUCT((CheckIn<=C$5)*(CheckOut>=C$5+1)*((RoomResN=$A6))),"")

    formula do what you wanted it to do?? I couldn't see how...

    Anyhow. You're welcome.



    If that takes care of your original question, please select "Thread Tools" from the menu link above and mark this thread as SOLVED.

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.

  14. #14
    Registered User
    Join Date
    04-02-2018
    Location
    Philippines
    MS-Off Ver
    2007
    Posts
    24

    Re: Need help to simplify my formulas since the calculation get slow.

    Yes it does, but before calculation takes up to 5 seconds. When I limit the value of RoomResN, calculation reduced to 2 seconds.
    Last edited by AliGW; 04-07-2018 at 05:32 AM. Reason: Unnecessary quotation removed.

  15. #15
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: Need help to simplify my formulas since the calculation get slow.

    Please don't quote whole posts, especially when you are responding to the one immediately preceding your own - it's just clutter. It's OK to quote if you are responding to a post out of sequence, but limit quoted content to a few relevant lines that makes clear to whom and what you are responding. Thanks!

    For normal conversational replies, try using the QUICK REPLY box below.

  16. #16
    Registered User
    Join Date
    04-02-2018
    Location
    Philippines
    MS-Off Ver
    2007
    Posts
    24

    Re: Need help to simplify my formulas since the calculation get slow.

    Sorry. Thank You!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Simplify Calculation, remove steps from existing sheet
    By snuffnchess in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 04-07-2016, 03:56 PM
  2. How can I simplify my formulas?
    By treken in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-03-2014, 10:45 PM
  3. [SOLVED] Is there a way to simplify this calculation?
    By M4RSH in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 12-05-2013, 06:24 AM
  4. Simplify XIIR Calculation in Excel
    By [email protected] in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-28-2013, 02:30 AM
  5. [SOLVED] Simplify Cell Formulas - AGAIN
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-05-2006, 09:50 AM
  6. Simplify Cell Formulas AGAIN
    By [email protected] in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-05-2006, 09:15 AM
  7. Simplify formulas
    By 0-0 Wai Wai ^-^ in forum Excel General
    Replies: 9
    Last Post: 07-23-2005, 04:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1