IF statement that will change by 2 instead of 1 when I drag it down

still learning

Well-known Member
Joined
Jan 15, 2010
Messages
708
Office Version
  1. 365
Platform
  1. Windows
Hi

Can I write an IF statement that will change by 2 instead of 1 when I drag it down?
Excel Formula:
=IF(B5=”x”,+C5,””)
I want the next line to be
Excel Formula:
=IF(B7=”x”,+C7,””)
Then the next line
Excel Formula:
=IF(B9=”x”,+C9,””)
All the way down to B45
If I copy the B5 statement down, it changes the B cell by 1. I need it to change by 2

The only way I know is to drag the first down, then delete every other line, then move the lines I didn’t delete up


mike
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
79,611
Office Version
  1. 365
Platform
  1. Windows
How about
Excel Formula:
=IF(INDEX(B:B,ROWS(M$3:M3)*2+3)="X",INDEX(C:C,ROWS(M$3:M3)*2+3),"")
 
Solution

still learning

Well-known Member
Joined
Jan 15, 2010
Messages
708
Office Version
  1. 365
Platform
  1. Windows
Hi Fluff,
Is M the column where the if statement goes?
I don't have time now, but I' try it this evening
I m trying to eliminate every other line to make it look nice. Now i have blank lines
B is where the "x" goes, C is a number
B is also where a "y" goes,
the if statement separates the two and gives a running total
the if statement starts in AC5 for "x" and
Ai5 for "y"
or course the x and y are longer words.
the data actually goes from B to G, but I thought if I had one statement correct, I can just change the letter :)
B is always "x" or "y", C,D,E,F,G is always numbers.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
79,611
Office Version
  1. 365
Platform
  1. Windows
Just change the M$3:M3 to reflect the first cell the formula is in.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
79,611
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback.
 

Forum statistics

Threads
1,181,212
Messages
5,928,724
Members
436,625
Latest member
agholson81

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top