# 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!

Super User Asked by Berchell on November 26, 2021

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

## Related Questions

0  Asked on December 19, 2020 by sudhakar-reddy

### Is there a way to force the new calculator application in Windows 10 to open only one instance of itself?

2  Asked on December 19, 2020 by holiveira

### Two hard disks suddenly failed: how can I prevent more broken hard disks?

1  Asked on December 19, 2020 by hoboist

### Unable to copy in bluestacks

2  Asked on December 18, 2020 by sagar

### What does this notification badge in macOS Catalina System Preferences mean?

1  Asked on December 18, 2020 by josh-cooley

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

1  Asked on December 18, 2020 by mijago

### Is FDK-AAC still better than FFmpeg’s native AAC encoder?

1  Asked on December 18, 2020

### Retrieving data from dead pc with Raid 10

0  Asked on December 18, 2020 by dgo

### Make “Everything” by VoidTools show up first in Windows Search

1  Asked on December 18, 2020 by jake

### XenServer: Backing up VMs to NAS

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

### Google Chrome: Is there a keyboard shortcut to open a link in a new tab?

6  Asked on December 17, 2020 by jan-aagaard

### Unable to find a suitable output format for ‘ffmpeg’ :Invalid argument

1  Asked on December 17, 2020 by abhijit-rajmane

### 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

### Windows 10 Creating recovery drive on 4gb usb stick

2  Asked on December 16, 2020 by cathat

### 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