Pelican Parts
Parts Catalog Accessories Catalog How To Articles Tech Forums
Call Pelican Parts at 888-280-7799
Shopping Cart Cart | Project List | Order Status | Help



Go Back   Pelican Parts Forums > Miscellaneous and Off Topic Forums > Off Topic Discussions


Reply
 
LinkBack Thread Tools Rate Thread
Author
Thread Post New Thread    Reply
Dept store Quartermaster
 
lendaddy's Avatar
 
Join Date: Jul 2001
Location: I'm right here Tati
Posts: 19,858
Can I get a little help on an Excel formula?

Seems there must be a simpler way to do this than what I have so far. I don't want to do reference cells so it needs to be done in one cell.

Anyway... assume there is a column of cells A1 through A10. I simply want to SUM all the occurrences of "3" in those cells.

Then, to that total, add the product of another cell (lets call it A12). But here's the kicker, I only want to add the amount from A12 that exceeds 2.

So if the product of A12 =1 then I don't want to add anything to my new cell, but if it's 6 I want to add 4. That's what has me hung up, if I simply subtract 2 from that cell as static part of my equation I will often get negative numbers which will screw everything up.

Any help is appreciated, I'm just too tired tonight.

__________________
Cornpoppin' Pony Soldier
Old 10-04-2013, 06:19 PM
  Pelican Parts Catalog | Tech Articles | Promos & Specials    Reply With Quote #1 (permalink)
dtw dtw is offline
GAFB
 
Join Date: Dec 1999
Location: Raleigh, NC, USA
Posts: 7,842
I don't have excel open so you might have to tweak syntax, but this should do it.

=SUMIF(A1:A10,"=3",A1:A10)+IF(A12>1,A12-2,0)
Old 10-04-2013, 06:29 PM
  Pelican Parts Catalog | Tech Articles | Promos & Specials    Reply With Quote #2 (permalink)
Dept store Quartermaster
 
lendaddy's Avatar
 
Join Date: Jul 2001
Location: I'm right here Tati
Posts: 19,858
Excellent, looks like that works. Thanks!
__________________
Cornpoppin' Pony Soldier
Old 10-04-2013, 06:34 PM
  Pelican Parts Catalog | Tech Articles | Promos & Specials    Reply With Quote #3 (permalink)
jyl jyl is online now
Registered
 
jyl's Avatar
 
Join Date: Jan 2002
Location: Nor California & Pac NW
Posts: 24,681
Garage
I think the second term would be +max(A12-2,0)

So if A12 = 6, max (6-2,0) = max (4,0) = 4

If A12 = 1, max (1-2,0) = max (-1,0) = 0

Last edited by jyl; 10-04-2013 at 06:42 PM..
Old 10-04-2013, 06:40 PM
  Pelican Parts Catalog | Tech Articles | Promos & Specials    Reply With Quote #4 (permalink)
Dept store Quartermaster
 
lendaddy's Avatar
 
Join Date: Jul 2001
Location: I'm right here Tati
Posts: 19,858
I spoke too soon, looks like there is trouble in using SUMIF, I don't want to add all the "3s" together, rather count the number of occurrences.

As given if four of the cells contain that "3" it is totaling it to 12 when I want it to be 4. I tried changing it from SUMIF to COUNTIF but it doesn't like that...hmmm
__________________
Cornpoppin' Pony Soldier
Old 10-04-2013, 07:00 PM
  Pelican Parts Catalog | Tech Articles | Promos & Specials    Reply With Quote #5 (permalink)
dtw dtw is offline
GAFB
 
Join Date: Dec 1999
Location: Raleigh, NC, USA
Posts: 7,842
Still no Excel in front of me, but play with COUNTIF. As a hack you could take the result of the SUMIF and divide by three, but it isn't the most elegant solution
Old 10-04-2013, 07:09 PM
  Pelican Parts Catalog | Tech Articles | Promos & Specials    Reply With Quote #6 (permalink)
 
Dept store Quartermaster
 
lendaddy's Avatar
 
Join Date: Jul 2001
Location: I'm right here Tati
Posts: 19,858
No sweat I got it, here was the solution (using the actual cells):

=COUNTIF(F4:AF42,2)+IF(F43>1,F43-2,0)

I sincerely appreciate the help, I normally have no problem with this stuff but I'm exhausted and about to go in for 8 hours more...
__________________
Cornpoppin' Pony Soldier
Old 10-04-2013, 07:10 PM
  Pelican Parts Catalog | Tech Articles | Promos & Specials    Reply With Quote #7 (permalink)
dtw dtw is offline
GAFB
 
Join Date: Dec 1999
Location: Raleigh, NC, USA
Posts: 7,842
Cool! Glad it is working for you now.
Old 10-04-2013, 07:11 PM
  Pelican Parts Catalog | Tech Articles | Promos & Specials    Reply With Quote #8 (permalink)
Moderator
 
Z-man's Avatar
 
Join Date: Feb 2001
Location: NJ, USA
Posts: 9,628
Garage
Quote:
Originally Posted by lendaddy View Post
I spoke too soon, looks like there is trouble in using SUMIF, I don't want to add all the "3s" together, rather count the number of occurrences.

As given if four of the cells contain that "3" it is totaling it to 12 when I want it to be 4. I tried changing it from SUMIF to COUNTIF but it doesn't like that...hmmm
If you sum all the 3's together, you can then divide that sum by 3 to get your count of the number of 3's, and go from there.

Whoops - I guess I'm a little late to the Excel party...

-Z
__________________
2010 Cayman S - 12-2020 -
2014 MINI Cooper S Coupe - 05-17 - 05-21
1989 944S2 - 06-01 - 01-14
Carpe Viam.
<><
Old 10-04-2013, 07:13 PM
  Pelican Parts Catalog | Tech Articles | Promos & Specials    Reply With Quote #9 (permalink)
Dept store Quartermaster
 
lendaddy's Avatar
 
Join Date: Jul 2001
Location: I'm right here Tati
Posts: 19,858
Quote:
Originally Posted by Z-man View Post
If you sum all the 3's together, you can then divide that sum by 3 to get your count of the number of 3's, and go from there.
I've gone that route before but in this case it would add yet another calculation to this "single cell" string. I'm trying to keep it as clean as possible. I do appreciate the idea though.

__________________
Cornpoppin' Pony Soldier
Old 10-04-2013, 07:15 PM
  Pelican Parts Catalog | Tech Articles | Promos & Specials    Reply With Quote #10 (permalink)
Reply


 


All times are GMT -8. The time now is 01:43 AM.


 
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0
Copyright 2025 Pelican Parts, LLC - Posts may be archived for display on the Pelican Parts Website -    DMCA Registered Agent Contact Page
 

DTO Garage Plus vBulletin Plugins by Drive Thru Online, Inc.