#1   Report Post  
Richard
 
Posts: n/a
Default Subtraction question

Subtracting cells C2 thru I2
Example: If C2 had 3436, D2 had 3395, E2 had 3376, then I need the answer in
cell J2 to be 60 EVEN IF THE CELLS F2 THRU I2 ARE BLANK.
This formula works fine if I have numbers in ALL cells (C2:I2)
"=MAX(C2:H2)-I2" but when there are blank cell it doesn't count right.
Thanks in advance!
  #2   Report Post  
Leo Heuser
 
Posts: n/a
Default

Richard

If I have understood your question correctly, this formula entered in J2
will do the trick.

=MAX(OFFSET(C2,,,,COUNTA(C2:I2)-1))-OFFSET(C2,,COUNTA(C2:I2)-1)

You can't have for instance a number in C2, D2 blank and a number in E2.
The blanks are supposed to come between the last filled cell in C2:I2 and
J2.

--
Best Regards
Leo Heuser

Followup to newsgroup only please.

"Richard" skrev i en meddelelse
...
Subtracting cells C2 thru I2
Example: If C2 had 3436, D2 had 3395, E2 had 3376, then I need the answer
in
cell J2 to be 60 EVEN IF THE CELLS F2 THRU I2 ARE BLANK.
This formula works fine if I have numbers in ALL cells (C2:I2)
"=MAX(C2:H2)-I2" but when there are blank cell it doesn't count right.
Thanks in advance!



  #3   Report Post  
Gary's Student
 
Posts: n/a
Default

How about =max(C2:I2)-MIN(C2:I2)

This should work because MIN ignores the empty cells


--
Gary's Student


"Leo Heuser" wrote:

Richard

If I have understood your question correctly, this formula entered in J2
will do the trick.

=MAX(OFFSET(C2,,,,COUNTA(C2:I2)-1))-OFFSET(C2,,COUNTA(C2:I2)-1)

You can't have for instance a number in C2, D2 blank and a number in E2.
The blanks are supposed to come between the last filled cell in C2:I2 and
J2.

--
Best Regards
Leo Heuser

Followup to newsgroup only please.

"Richard" skrev i en meddelelse
...
Subtracting cells C2 thru I2
Example: If C2 had 3436, D2 had 3395, E2 had 3376, then I need the answer
in
cell J2 to be 60 EVEN IF THE CELLS F2 THRU I2 ARE BLANK.
This formula works fine if I have numbers in ALL cells (C2:I2)
"=MAX(C2:H2)-I2" but when there are blank cell it doesn't count right.
Thanks in advance!




  #4   Report Post  
Leo Heuser
 
Posts: n/a
Default

"Gary's Student" skrev i en
meddelelse ...
How about =max(C2:I2)-MIN(C2:I2)

This should work because MIN ignores the empty cells


--
Gary's Student

The expression MAX(C2:H2) in the OP's formula indicates, that the
numbers from C2 to H2 are not always in descending order,
else he would have used C2 instead of MAX(C2:H2), I guess.

LeoH



  #5   Report Post  
Leo Heuser
 
Posts: n/a
Default

If the situation
You can't have for instance a number in C2, D2 blank and a number in E2.

arises, enter 0 (zero) in D2

LeoH




  #6   Report Post  
Richard
 
Posts: n/a
Default

YES! Now that works. Thanks so much Leo!! Don't understand it but it works

"Leo Heuser" wrote:

Richard

If I have understood your question correctly, this formula entered in J2
will do the trick.

=MAX(OFFSET(C2,,,,COUNTA(C2:I2)-1))-OFFSET(C2,,COUNTA(C2:I2)-1)

You can't have for instance a number in C2, D2 blank and a number in E2.
The blanks are supposed to come between the last filled cell in C2:I2 and
J2.

--
Best Regards
Leo Heuser

Followup to newsgroup only please.

"Richard" skrev i en meddelelse
...
Subtracting cells C2 thru I2
Example: If C2 had 3436, D2 had 3395, E2 had 3376, then I need the answer
in
cell J2 to be 60 EVEN IF THE CELLS F2 THRU I2 ARE BLANK.
This formula works fine if I have numbers in ALL cells (C2:I2)
"=MAX(C2:H2)-I2" but when there are blank cell it doesn't count right.
Thanks in advance!




  #7   Report Post  
Leo Heuser
 
Posts: n/a
Default

You're welcome, Richard, and thanks for the feedback :-)

LeoH

"Richard" skrev i en meddelelse
...
YES! Now that works. Thanks so much Leo!! Don't understand it but it works



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Subtraction Question Richard Excel Discussion (Misc queries) 6 May 22nd 05 01:54 AM
Hints And Tips For New Posters In The Excel Newsgroups Gary Brown Excel Worksheet Functions 0 April 15th 05 05:47 PM
Question about combining data from multiple workbooks into one rep BookOpenandUpright Excel Discussion (Misc queries) 2 February 19th 05 12:37 PM
An easy macro question and one I believe to be a little more diffi TroutKing Excel Worksheet Functions 3 January 18th 05 09:17 PM
Formula Question.....PLEASE PLEASE help! Anant Excel Discussion (Misc queries) 4 January 7th 05 09:30 AM


All times are GMT +1. The time now is 08:07 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"