csliger931
New Member
- Joined
- Jul 22, 2020
- Messages
- 21
- Office Version
- 365
- 2016
- Platform
- Windows
Hi,
I have what is probably an easy Excel question that is giving me some difficulty. I have a spreadsheet of Date/Time in Column A, Tank levels in column B, and in some of the rows I have an identifier PUMP OFF in Column N, and in some rows I have an identifier PUMP ON in Column N (Pump On/Off was based on whether I had continuous positive or negative numbers in Column B...that part is unimportant). In all rows where Column N = PUMP ON, I want to subtract the Tank Level in Cell B from that row from the Tank level in the most recent row where I have Column N = PUMP OFF. For example, Lets say in Row 55 I have Cell B = 2.18 and Cell N = PUMP OFF. Then in Rows 56-65, I have various values in Cell B and Cell N is blank. Then, in Row 66, I have a value in Cell B = 2.479, and Cell N = PUMP ON. I want Cell O66 to subtract 2.479-2.18 = 0.299. And I want Column O to be automated where I don't have to type "=BXY-BXX" at each instance of Pump On. I want Excel to find the PUMP ON for me, and then find the previous Tank Level where PUMP OFF. As I get further down the spreadsheet, I will have more instances of "PUMP ON" and "PUMP OFF", but it is never a fixed amount of rows between each PUMP ON and PUMP OFF, so I can't just type in cell O130 "=B130-B120" and then drag down....it may be that the next instance is =B142-B137, or =B146-B137, etc. I need Excel to recognize when the next immediate instance of PUMP ON occurs, and then to subtract the Tank Level in the most recent row where PUMP OFF from the Tank Level where PUMP ON.
Any ideas? Even if you just tell me the formula or operator to Google, that would give me a headstart. I can't download XL2BB to my computer at work, so I've attached my spreadsheet as an image.
Thanks!
Chris
I have what is probably an easy Excel question that is giving me some difficulty. I have a spreadsheet of Date/Time in Column A, Tank levels in column B, and in some of the rows I have an identifier PUMP OFF in Column N, and in some rows I have an identifier PUMP ON in Column N (Pump On/Off was based on whether I had continuous positive or negative numbers in Column B...that part is unimportant). In all rows where Column N = PUMP ON, I want to subtract the Tank Level in Cell B from that row from the Tank level in the most recent row where I have Column N = PUMP OFF. For example, Lets say in Row 55 I have Cell B = 2.18 and Cell N = PUMP OFF. Then in Rows 56-65, I have various values in Cell B and Cell N is blank. Then, in Row 66, I have a value in Cell B = 2.479, and Cell N = PUMP ON. I want Cell O66 to subtract 2.479-2.18 = 0.299. And I want Column O to be automated where I don't have to type "=BXY-BXX" at each instance of Pump On. I want Excel to find the PUMP ON for me, and then find the previous Tank Level where PUMP OFF. As I get further down the spreadsheet, I will have more instances of "PUMP ON" and "PUMP OFF", but it is never a fixed amount of rows between each PUMP ON and PUMP OFF, so I can't just type in cell O130 "=B130-B120" and then drag down....it may be that the next instance is =B142-B137, or =B146-B137, etc. I need Excel to recognize when the next immediate instance of PUMP ON occurs, and then to subtract the Tank Level in the most recent row where PUMP OFF from the Tank Level where PUMP ON.
Any ideas? Even if you just tell me the formula or operator to Google, that would give me a headstart. I can't download XL2BB to my computer at work, so I've attached my spreadsheet as an image.
Thanks!
Chris