AnswerBun.com

IF statement that changes based on met condition

Column B is the time in minutes in 1 minute increments. Column I is the time in minutes, but in 1 second increments.

Column C has a list of temperatures. Is there a way to fill Column I with temperatures from Column C that correspond to the correct minute.

The correct results would be once the value in Column I was 1 Column J would be populated with 80 and then once the value in Column I was 2 Column J would be populated with 102.

I wrote the following formula and it works until it gets to 1, but doesn’t work after that. I am not sure how to create an IF statement that changes once a condition is met.

Formula:
=IF(I11=$B$11,$C$11,"")

Any help would be great!

Excel Screenshot

Super User Asked by Berchell on November 26, 2021

2 Answers

2 Answers

In cell J3 enter the formula =INDEX(C:C,MATCH(INT(I3),B:B,0)) and copy down.

To understand the formula, work inside out:

  1. INT(x) returns minute 1 given minute 1.033
  2. MATCH(INT(x),B:B,0) finds the row in column B in which minute 1 appears
  3. INDEX(C:C,MATCH(INT(x),B:B,0)) picks the temperature in column C corresponding to that row in column B

Answered by bkraines on November 26, 2021

If I understand you properly, this is simply called "nesting."

An IF statement in Excel is =IF(TRUE,DO IF TRUE, DO IF FALSE) and so you simply insert another full IF statement as one of the branches. You can put the IF statement in either (or both) decision branch.

Again, if I have followed your question, you can start with the least likely or last condition, and then nest additional tests in reverse order. It sometimes helps to write it out using notepad or something and then collapse the spacing to fit as a formula (this is pseudocode to hopefully help illustrate the idea better):

=IF(Field = COL3, UseCOL3, 
    IF(Field = COL2, UseCOL2,
        IF(Field = COL1, UseCOL1,
            NoValue
        )
    )
)

Or:

=IF(Field = COL3, UseCOL3,IF(Field = COL2, UseCOL2,IF(Field = COL1, UseCOL1,NoValue)))

It can get "hairy" very quickly.

https://support.microsoft.com/en-us/office/if-function-%E2%80%93-nested-formulas-and-avoiding-pitfalls-0b22ff44-f149-44ba-aeb5-4ef99da241c8

Answered by Yorik on November 26, 2021

Add your own answers!

Related Questions

access to Azure Active Directory

0  Asked on December 19, 2020 by sudhakar-reddy

 

Unable to copy in bluestacks

2  Asked on December 18, 2020 by sagar

         

SSH Multiple Session -> “stdin: is not a tty”

1  Asked on December 18, 2020 by mijago

       

XenServer: Backing up VMs to NAS

0  Asked on December 17, 2020 by grumpy-ol-bear

     

VirtualBox is very slow in Windows 10

11  Asked on December 17, 2020 by ali

     

Sed for windows

2  Asked on December 17, 2020 by thesavo

     

Identify 4-pin power socket

0  Asked on December 16, 2020 by c_b

     

AT commands to activate CDMA modem?

0  Asked on December 16, 2020 by david-pfeffer

     

ssh-keyscan returns different values on each invocation

0  Asked on December 16, 2020 by sweetjonnie

 

less command does not open zip files on debian

2  Asked on December 16, 2020 by m-j

         

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved.