Share via

simplifying long IF function

Anonymous
2024-10-22T19:00:07+00:00

I have data in two tabs. Tab A contains data for 40 vessels, labeled 1-40. I would like to use this data from tab A, in an equation in tab B. The data in tab b will have random vessel numbers, and I have a total of 144 samples, so to pull the data to subtract from the same 40 rows in tab A will be quicker.

I have done a longer IF function, i.e. =IF(A1=1, (equation 1), IF(A1=2, (equation 2), IF(A1=3, (equation 3), "-")))

What I would like to do is, in column C in tab B, IF(A1=1, (B1-'tab A'!B$1), IF(A1=2, (B1-'tab A'!B$2), etc,

I don't want to have to write out all 40 IF statements if there is a better way.

Is there any way to make that a shorter equation to accomplish this task or am I stuck writing out the full sentence?

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

1 answer

Sort by: Most helpful
  1. HansV 462.6K Reputation points
    2024-10-22T19:26:37+00:00

    Try

    =B1-INDIRECT("'tab A'!B"&A1)
    

    Was this answer helpful?

    0 comments No comments