Calculate ranges based on 2 columns

gschmidt

New Member
Joined
May 24, 2021
Messages
13
Office Version
  1. 2016
Hi,

I have 2 columns with data:
  • Column A has chainage (CH) values, which are ascending consecutive numbers, and not always start with chainage 1
  • Column B has FALSE/TRUE values
I want to determine the values of all the Start (see column D) and End chainages (see column E), for the rows where the value of column B between Start and End is TRUE.
See example picture.

This is an example of 30 lines for column A/B, but the amount of rows and the amount of TRUE/FALSE values may differ
So the amount of [D] Start CH and [E] End CH rows also may differ

How do I do this in Excel?

1621877438141.png
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
You're welcome & thanks for the feedback.
 
Upvote 0
You're welcome & thanks for the feedback.

Now that the formula is working I have 2 other questions about the formula.

  1. Between Start CH and End CH is a gap of 3 (from 37712-37717 to 37720-37724), because 37720 - 37717 = 3.
    Which means 37718 and 37719 must have a FALSE boolean value.
    Is it possible to modify the formula to:
    IF the Gap between 2 consecutive ranges is smaller/or equal than a given number e.g. 3
    THEN the range becomes according to table: 37712-37784
    1621944399680.png


    If this is possible I would feed it with a fixed cell value as in the example

    1621945744824.png


  2. Will the formula still work if the difference between two consecutive Chainage cells is not 1 but e.g. 2?
    e.g. 23400, 23402, 32404, etc.
 
Upvote 0
I'm afraid I have no idea how to do that. I suggest you start a new thread & see if anyone else has an idea.
 
Upvote 0

Forum statistics

Threads
1,214,875
Messages
6,122,044
Members
449,063
Latest member
ak94

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top