+ Reply to Thread
Results 1 to 11 of 11

How to find the correct value when considering two variables?

  1. #1
    Registered User
    Join Date
    05-17-2020
    Location
    Heiloo, Nederland
    MS-Off Ver
    2007
    Posts
    32

    Question How to find the correct value when considering two variables?

    Good day all again.
    Yeah, I'm busy programming again and I have hit another challenge I sadly can't solve...

    What is it? Well... I am trying to get a list of pitstops, vertical list, into a list that shows the lapnumbers of the pitstops behind each driver. Some made no pitstops, some 3, some 1, most 2. With this double variable (starting number and number of pitstop) I get confused. I can work out the first pitstop correctly with an iferror formula combined with a vlookup, but with the second one it goes wrong when the driver made a third stop (then only the third shows up and not the second, resulting in first, third, third).

    See attachment for how I would like to see the results. And yes, it is just filled in by hand. But my idea is: the more Excel does, the less mistakes there are made. So my question is: what formula(e) should I use to get the final result I desire (Col. E-L). So yeah, it might be that a driver stops 4 or 5 times...

    Thanks in advance for reading, trying or solving. It's appreciated.

    Kind regards,
    Daniël.
    Attached Files Attached Files
    Thank you for your helpful answer.

  2. #2
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,740

    Re: How to find the correct value when considering two variables?

    How about
    In G4 copied down
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and in H4 copied down & across
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    The H4 formula needs to be confirmed with Ctrl Shift Enter before dragging down & across

  3. #3
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,729

    Re: How to find the correct value when considering two variables?

    In H4

    ==IF(COLUMNS($H$1:H$1)<=$G4,INDEX($C$4:$C$43,MATCH($E4,$A$4:$A$43,0)+COLUMNS($H1:H1)-1),"")

    copy across and down
    Last edited by JohnTopley; 05-22-2021 at 03:08 PM.

  4. #4
    Registered User
    Join Date
    05-17-2020
    Location
    Heiloo, Nederland
    MS-Off Ver
    2007
    Posts
    32

    Re: How to find the correct value when considering two variables?

    Quote Originally Posted by Fluff13 View Post
    How about
    In G4 copied down
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and in H4 copied down & across
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    The H4 formula needs to be confirmed with Ctrl Shift Enter before dragging down & across
    That formula will result in the total number of stops, being the value calculated in column G. Sadly that was not what I was looking for. I am interested in how to get the laps (col. C) into col. G-L.

  5. #5
    Registered User
    Join Date
    05-17-2020
    Location
    Heiloo, Nederland
    MS-Off Ver
    2007
    Posts
    32

    Re: How to find the correct value when considering two variables?

    Quote Originally Posted by JohnTopley View Post
    In H4

    ==IF(COLUMNS($H$1:H$1)<=$G4,INDEX($C$4:$C$43,MATCH($E4,$A$4:$A$43,0)+COLUMNS($H1:H1)-1),"")

    copy across and down
    I had to replace the , with ; and ajust the column letters, but sadly this is what I get for result... Did I do something wrong?
    Attached Images Attached Images

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,740

    Re: How to find the correct value when considering two variables?

    I am interested in how to get the laps (col. C) into col. G-L.
    That's what the formula in H4 does.
    Attached Files Attached Files

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,729

    Re: How to find the correct value when considering two variables?

    See attached
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    05-17-2020
    Location
    Heiloo, Nederland
    MS-Off Ver
    2007
    Posts
    32

    Re: How to find the correct value when considering two variables?

    Yeah, seems like I made a mistake in both Fluff13's formulae and JohnTopley's formulae. Thanks, both are working now. I appreciate the effort and the thinking along.

  9. #9
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,740

    Re: How to find the correct value when considering two variables?

    Glad to help & thanks for the feedback.

  10. #10
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,729

    Re: How to find the correct value when considering two variables?

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

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  11. #11
    Registered User
    Join Date
    05-17-2020
    Location
    Heiloo, Nederland
    MS-Off Ver
    2007
    Posts
    32

    Re: How to find the correct value when considering two variables?

    Quote Originally Posted by JohnTopley View Post
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.
    I did. Just was waiting for your reply before closing. :-)

+ 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] Excel Solver - variables not changing or solution not correct
    By CaptainCow in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-04-2021, 12:03 PM
  2. The Correct Syntax For Using Variables With Square Bracket Arrays
    By Genus Max in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-26-2020, 07:47 PM
  3. Replies: 5
    Last Post: 02-23-2019, 07:21 PM
  4. search 2 variables, return the correct one beside each match
    By katri80 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-12-2016, 03:39 PM
  5. for/next Correct Syntax for Ranges with variables
    By beat in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-19-2013, 11:14 AM
  6. correct function to find a correct time value
    By jekidi in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 07-06-2013, 03:17 PM
  7. Replies: 2
    Last Post: 04-28-2013, 05:55 PM

Tags for this Thread

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