Excel 2010 - How to find first cell starting with a digit within a column up words?

StackOverflow https://stackoverflow.com/questions/23628576

  •  21-07-2023
  •  | 
  •  

Question

Good day! I am asking just for the following scenario in Excel 2010:

Overhaul type               User Input
5   
5   
5   
Overhaul                    1
Overhaul                    1
10  
10  
10  
10  
10  
Overhaul                    1
Overhaul                    1
Overhaul                    1
5   
5   
5   
5   
5   
Overhaul                    1
10  
10  
10  
10  
10  

Sorry for the above presentation style; due to lack of rep, I could not attach the screenshot!

The first column (Overhaul type) I need to program for automation. The user will only give the input in the second column; i.e, "User Input". The Overhaul duration is variable. That means, any amount of cells in this column may have the value "Overhaul". For that, user will enter just 1 in the second column in the appropriate row. And '5' and '10' are overhaul type. There are only two types of overhaul. What I need is, the automation of first column.

I this case, I thought the algorithm as:

  1. Check cell in the second column in the same row. If the value is 1, return value will be Overhaul. If the value is NULL, return value will be equal the value of cell in same column previous row if that is a number.

  2. But my problem is, if more than 1 previous days are under Overhaul, I'll have to return the opposite value(10 of 5, 5 for 10) of upper cell till first digit got in the upper side.

The first point, I'm OK with the coding. But I could not figure out the second point!

Note: I do not want to use VB Macro! I want simply the Excel formulas to achieve this.

Thank in advance. Take care.

Was it helpful?

Solution

Add a helper column with formula like (let's have it in cell C2 and drag it down):

=IF($A2="Overhaul",$C1,IF($A2=10,5,10))

Then the final result (in D2):

=IF($B2=1,"Overhaul",$C2)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top